Skip to content

Commit e497e81

Browse files
netraptordemurgos
authored andcommitted
feature: add support for COSMIC Epoch
1 parent dbf3912 commit e497e81

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Next
22

3+
- **[Feature]** Detect COSMIC Epoch. ([@netraptor](https://github.com/netraptor), [#13](https://github.com/demurgos/detect-desktop-environment/pull/13))
34
- **[Fix]** Fix spelling when matching `GNOME-Classic`. ([@bash](https://github.com/bash), [#11](https://github.com/demurgos/detect-desktop-environment/pull/11))
45
- **[Fix]** Remove thumbnails from Cargo package, for faster downloads. ([@bbb651](https://github.com/bbb651), [#12](https://github.com/demurgos/detect-desktop-environment/pull/12))
56

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ section.
4040
|-----------------|--------------------------------------------------|
4141
| `Cinnamon` | ![Cinnamon](./thumbnails/cinnamon.png) |
4242
| `Cosmic` | ![COSMIC](./thumbnails/cosmic.png) |
43+
| `Cosmic Epoch` | ![COSMIC Epoch](./thumbnails/cosmic-epoch.png) |
4344
| `Dde` | ![Deepin DE](./thumbnails/dde.png) |
4445
| `Ede` | ![EDE](./thumbnails/ede.png) |
4546
| `Endless` | ![Endless](./thumbnails/endless.png) |

src/lib.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,21 @@ pub enum DesktopEnvironment {
2525
///
2626
/// - <https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment)>
2727
Cinnamon,
28-
/// COSMIC, the default desktop environment for Linux Pop!_OS.
28+
/// COSMIC, the legacy GNOME-based desktop environment for Linux Pop!_OS.
2929
///
30-
/// Note: This corresponds to the classic COSMIC based on GNOME, not the Rust
31-
/// [COSMIC-epoch](https://github.com/pop-os/cosmic-epoch). Please send a PR if you can
32-
/// test how to detect cosmic-epoch.
30+
/// Note: This corresponds to the classic COSMIC based on GNOME. For the new
31+
/// [COSMIC Epoch](https://github.com/pop-os/cosmic-epoch) desktop
32+
/// environment built in Rust, use [`DesktopEnvironment::CosmicEpoch`].
3333
///
3434
/// - <https://github.com/pop-os/cosmic>
3535
Cosmic,
36+
/// COSMIC Epoch
37+
///
38+
/// Note: This corresponds to the new COSMIC desktop environment
39+
/// built by System76 in Rust for Linux Pop!_OS.
40+
///
41+
/// - <https://github.com/pop-os/cosmic-epoch>
42+
CosmicEpoch,
3643
/// Deepin desktop environment
3744
///
3845
/// - <https://www.deepin.org/index/en>
@@ -206,6 +213,7 @@ impl DesktopEnvironment {
206213
pub fn from_freedesktop(name: &str) -> Option<Self> {
207214
// the patterns in the match below are ordered to match the order in the freedesktop table
208215
match name {
216+
"COSMIC" => Some(DesktopEnvironment::CosmicEpoch),
209217
"GNOME" => Some(DesktopEnvironment::Gnome),
210218
"GNOME-Classic" => Some(DesktopEnvironment::Gnome),
211219
"GNOME-Flashback" => Some(DesktopEnvironment::Gnome),
@@ -368,6 +376,10 @@ mod tests {
368376
DesktopEnvironment::from_xdg_current_desktop("Hyprland"),
369377
Some(DesktopEnvironment::Hyprland)
370378
);
379+
assert_eq!(
380+
DesktopEnvironment::from_xdg_current_desktop("COSMIC"),
381+
Some(DesktopEnvironment::CosmicEpoch)
382+
);
371383

372384
// Colon splitting
373385
assert_eq!(

thumbnails/cosmic-epoch.png

60.8 KB
Loading

0 commit comments

Comments
 (0)