#desktop-environment #detect #env

bin+lib detect-desktop-environment

Autodetect the desktop environment

4 releases (2 stable)

1.1.0 Apr 16, 2024
1.0.0 Mar 18, 2023
0.2.0 Dec 2, 2017
0.1.0 Dec 2, 2017

#76 in GUI

Download history 2806/week @ 2024-08-09 1949/week @ 2024-08-16 2296/week @ 2024-08-23 3041/week @ 2024-08-30 2799/week @ 2024-09-06 3163/week @ 2024-09-13 3288/week @ 2024-09-20 3573/week @ 2024-09-27 3061/week @ 2024-10-04 3123/week @ 2024-10-11 3229/week @ 2024-10-18 2759/week @ 2024-10-25 3821/week @ 2024-11-01 2502/week @ 2024-11-08 2605/week @ 2024-11-15 2404/week @ 2024-11-22

11,734 downloads per month
Used in 29 crates (via dark-light)

MIT license

1.5MB
215 lines

Detect Desktop Environment

GitHub crates.io CI status docs.rs/detect-desktop-environment license MIT

This crate helps you to detect the current desktop environment. It was inspired by the detectDE function from xdg-util.

Installation

Run the following command in your project:

cargo add detect-desktop-environment

Usage

use detect_desktop_environment::DesktopEnvironment;

fn main() {
    match DesktopEnvironment::detect() {
        Some(de) => println!("detected desktop environment: {de:?}"),
        None => println!("failed to detect desktop environment"),
    }
}

This library exposes two symbols: the detect function and it returns value: the DesktopValue enum. All the variants are listed below in the "Supported environments" section.

Supported environments

Name Thumbnail
Cinnamon Cinnamon
Cosmic COSMIC
Dde Deepin DE
Ede EDE
Endless Endless
Enlightenment Enlightenment
Gnome Gnome
Hyprland Hyprland
Kde Kde
Lxde Lxde
Lxqt Lxqt
MacOs MacOs
Mate Mate
Old Old
Pantheon Pantheon
Razor Razor
Rox Rox
Sway Sway
Tde Tde
Unity Unity
Windows Windows
Xfce Xfce

Documentation

See docs.rs/detect-desktop-environment.

Maintenance status

This library is stable and no major changes are expected.

If you want to improve the library, feel free to open an issue or send a PR. Breaking changes are allowed. Note however that review times may be slow.

Minimum Supported Rust Version (MSRV) policy

The last 8 stable versions are explicitly supported (1 year). See Cargo.toml for details.

License

MIT

No runtime deps