#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

#83 in GUI

Download history 939/week @ 2024-02-26 1065/week @ 2024-03-04 1464/week @ 2024-03-11 1310/week @ 2024-03-18 1961/week @ 2024-03-25 2184/week @ 2024-04-01 1526/week @ 2024-04-08 1750/week @ 2024-04-15 1628/week @ 2024-04-22 2044/week @ 2024-04-29 1821/week @ 2024-05-06 1625/week @ 2024-05-13 1510/week @ 2024-05-20 1662/week @ 2024-05-27 1637/week @ 2024-06-03 1740/week @ 2024-06-10

6,710 downloads per month
Used in 26 crates (via dark-light)

MIT license

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.


Run the following command in your project:

cargo add detect-desktop-environment


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
Dde Deepin DE
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


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.



No runtime deps