|
| 1 | +<!-- |
| 2 | + Copyright 2022-2025 TII (SSRC) and the Ghaf contributors |
| 3 | + SPDX-License-Identifier: CC-BY-SA-4.0 |
| 4 | +--> |
| 5 | + |
| 6 | +# COSMIC Desktop Environment |
| 7 | + |
| 8 | +[COSMIC](https://github.com/pop-os/cosmic-epoch) is a modern, configurable, and lightweight Wayland desktop environment developed by System76. It is designed to be fast, efficient and user-friendly while maintaining a professional appearance. |
| 9 | +As of February 2025, COSMIC's latest release is Alpha 6, with a beta release planned in the coming months. |
| 10 | + |
| 11 | +## Enabling COSMIC in Ghaf |
| 12 | + |
| 13 | +While COSMIC is not the default desktop environment in Ghaf, it can be enabled manually. To enable COSMIC DE in Ghaf, modify the graphics configuration as shown below: |
| 14 | + |
| 15 | +```nix |
| 16 | +profiles.graphics.compositor = "cosmic"; |
| 17 | +``` |
| 18 | + |
| 19 | +This configuration sets COSMIC as the active desktop environment for Ghaf. |
| 20 | + |
| 21 | +> **Note**: Starting from April 2025, COSMIC DE is fully integrated into NixOS options, and its tools are included in `nixpkgs`. Prior to this, COSMIC had to be added to Ghaf from the external flake [nixos-cosmic](https://github.com/lilyinstarlight/nixos-cosmic). |
| 22 | +
|
| 23 | +## Configuration Components |
| 24 | + |
| 25 | +COSMIC's configuration in Ghaf consists of several key components: |
| 26 | + |
| 27 | +### 1. Core COSMIC DE Configuration |
| 28 | + |
| 29 | +COSMIC handles its configuration via simple Rust Object Notation (RON) files located in the user's home directory under `.config/cosmic`. |
| 30 | + |
| 31 | +In the Ghaf Nix configuration, however, we have introduced a conversion mechanism where the entire directory tree is represented by a single YAML file (`cosmic.config.yaml`). This YAML file acts as the system default COSMIC configuration and is applied to all fresh installations of Ghaf. |
| 32 | + |
| 33 | +If the user makes manual changes to the configuration while using Ghaf, those changes will take precedence over the system defaults. |
| 34 | + |
| 35 | +### 2. Ghaf COSMIC Nix Configuration |
| 36 | + |
| 37 | +The `cosmic.nix` module in Ghaf customizes COSMIC to better align with the system's requirements. Below are the key modifications and adjustments made: |
| 38 | + |
| 39 | +#### Disabled COSMIC Settings pages |
| 40 | +- **User Management**: The `page-users` feature in COSMIC settings is disabled. |
| 41 | +- **Power Settings**: The `page-power` feature is removed, as power management is handled by `swayidle` and `ghaf-powercontrol`. |
| 42 | +- **Sound Settings**: The `page-sound` feature is disabled, with audio control managed by a custom service. |
| 43 | + |
| 44 | +#### Replacements and Overrides |
| 45 | +- **Icon Theme**: The default COSMIC icon theme is changed to Papirus icon theme. |
| 46 | +- **GTK Settings**: Some default GTK settings are applied to ensure a consistent look and feel. |
| 47 | +- **Session Management**: COSMIC's session management integrates with `ghaf-session.target` for better control of Ghaf services. |
| 48 | +- **Power Management**: `swayidle` replaces `cosmic-idle` as the default idle and power manager, including configuration for automatic suspend and brightness adjustments. |
| 49 | +- **Audio Control**: A custom Ghaf audio control service works alongside the COSMIC audio applet to provide Ghaf-specific audio control features. |
| 50 | + |
| 51 | +#### Additional Changes |
| 52 | +- **DBUS Proxy Integration**: Custom DBUS proxy sockets are added for audio, network, and Bluetooth applets. |
| 53 | +- **Configuration Format**: COSMIC's configuration is centralized into a single YAML file (`cosmic.config.yaml`) for easier management and deployment. This configuration is installed as an explicit package `ghaf-cosmic-config`, the derivation of which can be found in `cosmic.nix`. |
| 54 | +- **Disabled Services**: Several default services, such as `geoclue2`, `pipewire`, and `gnome-keyring`, are explicitly disabled. |
| 55 | + |
| 56 | +These changes ensure that COSMIC in Ghaf is tailored to the system's specific needs. |
| 57 | + |
| 58 | +## Configuration Files |
| 59 | +The main configuration files are located in the `modules/desktop/graphics/` directory: |
| 60 | + |
| 61 | +``` |
| 62 | +modules/desktop/graphics/ |
| 63 | +├── cosmic-config/ |
| 64 | +│ ├── cosmic-config-to-yaml.sh # Helper script to convert `.config/cosmic` to a YAML config |
| 65 | +│ └── cosmic.config.yaml # Main COSMIC desktop configuration which expands into `.config/cosmic` |
| 66 | +└── cosmic.nix # Main COSMIC Nix configuration |
| 67 | +``` |
| 68 | + |
| 69 | +## Known Limitations |
| 70 | + |
| 71 | +- COSMIC does not allow forcing Server-Side Decorations for apps running under COSMIC |
| 72 | +- COSMIC does not yet support all common Wayland protocols (e.g. zwlr_virtual_pointer_manager_v1, etc.) |
| 73 | +- COSMIC is still in relatively early development, with a Beta release planned some time in 2025 |
| 74 | + |
| 75 | +For more detailed information about COSMIC's architecture and features, visit the [COSMIC Epoch repository](https://github.com/pop-os/cosmic-epoch) and the [System76 COSMIC Epoch homepage](https://system76.com/cosmic/). |
0 commit comments