diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f4a26f..6f56f97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Next +- **[Feature]** Detect COSMIC Epoch. ([@netraptor](https://github.com/netraptor), [#13](https://github.com/demurgos/detect-desktop-environment/pull/13)) - **[Fix]** Fix spelling when matching `GNOME-Classic`. ([@bash](https://github.com/bash), [#11](https://github.com/demurgos/detect-desktop-environment/pull/11)) - **[Fix]** Remove thumbnails from Cargo package, for faster downloads. ([@bbb651](https://github.com/bbb651), [#12](https://github.com/demurgos/detect-desktop-environment/pull/12)) diff --git a/README.md b/README.md index a914267..e6a1152 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ section. |-----------------|--------------------------------------------------| | `Cinnamon` | ![Cinnamon](./thumbnails/cinnamon.png) | | `Cosmic` | ![COSMIC](./thumbnails/cosmic.png) | +| `Cosmic Epoch` | ![COSMIC Epoch](./thumbnails/cosmic-epoch.png) | | `Dde` | ![Deepin DE](./thumbnails/dde.png) | | `Ede` | ![EDE](./thumbnails/ede.png) | | `Endless` | ![Endless](./thumbnails/endless.png) | diff --git a/src/lib.rs b/src/lib.rs index 2b53271..d72d663 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,14 +25,21 @@ pub enum DesktopEnvironment { /// /// - Cinnamon, - /// COSMIC, the default desktop environment for Linux Pop!_OS. + /// COSMIC, the legacy GNOME-based desktop environment for Linux Pop!_OS. /// - /// Note: This corresponds to the classic COSMIC based on GNOME, not the Rust - /// [COSMIC-epoch](https://github.com/pop-os/cosmic-epoch). Please send a PR if you can - /// test how to detect cosmic-epoch. + /// Note: This corresponds to the classic COSMIC based on GNOME. For the new + /// [COSMIC Epoch](https://github.com/pop-os/cosmic-epoch) desktop + /// environment built in Rust, use [`DesktopEnvironment::CosmicEpoch`]. /// /// - Cosmic, + /// COSMIC Epoch + /// + /// Note: This corresponds to the new COSMIC desktop environment + /// built by System76 in Rust for Linux Pop!_OS. + /// + /// - + CosmicEpoch, /// Deepin desktop environment /// /// - @@ -206,6 +213,7 @@ impl DesktopEnvironment { pub fn from_freedesktop(name: &str) -> Option { // the patterns in the match below are ordered to match the order in the freedesktop table match name { + "COSMIC" => Some(DesktopEnvironment::CosmicEpoch), "GNOME" => Some(DesktopEnvironment::Gnome), "GNOME-Classic" => Some(DesktopEnvironment::Gnome), "GNOME-Flashback" => Some(DesktopEnvironment::Gnome), @@ -368,6 +376,10 @@ mod tests { DesktopEnvironment::from_xdg_current_desktop("Hyprland"), Some(DesktopEnvironment::Hyprland) ); + assert_eq!( + DesktopEnvironment::from_xdg_current_desktop("COSMIC"), + Some(DesktopEnvironment::CosmicEpoch) + ); // Colon splitting assert_eq!( diff --git a/thumbnails/cosmic-epoch.png b/thumbnails/cosmic-epoch.png new file mode 100644 index 0000000..100071d Binary files /dev/null and b/thumbnails/cosmic-epoch.png differ