Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for COSMIC Epoch #13

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading