Crates.io | detect-desktop-environment |
lib.rs | detect-desktop-environment |
version | |
source | src |
created_at | 2017-12-02 19:31:33.782225 |
updated_at | 2025-01-03 20:53:55.717851 |
description | Autodetect the desktop environment |
homepage | https://github.com/demurgos/detect-desktop-environment |
repository | https://github.com/demurgos/detect-desktop-environment |
max_upload_size | |
id | 41379 |
Cargo.toml error: | TOML parse error at line 20, column 1 | 20 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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.
Name | Thumbnail |
---|---|
Cinnamon |
![]() |
Cosmic |
![]() |
Cosmic Epoch |
![]() |
Dde |
![]() |
Ede |
![]() |
Endless |
![]() |
Enlightenment |
![]() |
Gnome |
![]() |
Hyprland |
![]() |
Kde |
![]() |
Lxde |
![]() |
Lxqt |
![]() |
MacOs |
![]() |
Mate |
![]() |
Old |
![]() |
Pantheon |
![]() |
Razor |
![]() |
Rox |
![]() |
Sway |
![]() |
Tde |
![]() |
Unity |
![]() |
Windows |
![]() |
Xfce |
![]() |
See docs.rs/detect-desktop-environment.
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.
The last 8 stable versions are explicitly supported (1 year). See Cargo.toml for details.