#detect #env #desktop-environment

bin+lib detect-desktop-environment

Autodetect the desktop environment

3 releases (1 stable)

new 1.0.0 Mar 18, 2023
0.2.0 Dec 2, 2017
0.1.0 Dec 2, 2017

#38 in GUI

Download history 1554/week @ 2022-11-29 1939/week @ 2022-12-06 1905/week @ 2022-12-13 1426/week @ 2022-12-20 1213/week @ 2022-12-27 1364/week @ 2023-01-03 1932/week @ 2023-01-10 1644/week @ 2023-01-17 2632/week @ 2023-01-24 2201/week @ 2023-01-31 2949/week @ 2023-02-07 4468/week @ 2023-02-14 2892/week @ 2023-02-21 4209/week @ 2023-02-28 4543/week @ 2023-03-07 3003/week @ 2023-03-14

15,259 downloads per month
Used in 26 crates (via dark-light)

MIT license

720KB
65 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
Enlightenment Enlightenment
Gnome Gnome
Kde Kde
Lxde Lxde
Lxqt Lxqt
MacOs MacOs
Mate Mate
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