Skip to content

Commit

Permalink
feature: add support for COSMIC Epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
netraptor authored and demurgos committed Jan 3, 2025
1 parent dbf3912 commit e497e81
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down
20 changes: 16 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,21 @@ pub enum DesktopEnvironment {
///
/// - <https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment)>
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`].
///
/// - <https://github.com/pop-os/cosmic>
Cosmic,
/// COSMIC Epoch
///
/// Note: This corresponds to the new COSMIC desktop environment
/// built by System76 in Rust for Linux Pop!_OS.
///
/// - <https://github.com/pop-os/cosmic-epoch>
CosmicEpoch,
/// Deepin desktop environment
///
/// - <https://www.deepin.org/index/en>
Expand Down Expand Up @@ -206,6 +213,7 @@ impl DesktopEnvironment {
pub fn from_freedesktop(name: &str) -> Option<Self> {
// 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),
Expand Down Expand Up @@ -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!(
Expand Down
Binary file added thumbnails/cosmic-epoch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e497e81

Please sign in to comment.