Skip to main content

detect_linux_desktop

Function detect_linux_desktop 

Source
pub fn detect_linux_desktop() -> LinuxDesktop
Expand description

Detect the current Linux desktop environment.

Reads XDG_CURRENT_DESKTOP and returns the recognized desktop. Returns LinuxDesktop::Unknown if the variable is unset or contains no recognized value.

For testable parsing without environment access, use the pub parse_linux_desktop() function instead.

ยงExamples

use native_theme::detect::{detect_linux_desktop, LinuxDesktop};

let de = detect_linux_desktop();
match de {
    LinuxDesktop::Kde => println!("KDE Plasma"),
    LinuxDesktop::Gnome => println!("GNOME"),
    _ => println!("Other: {de:?}"),
}