Jump to content

COSMIC: Difference between revisions

From NixOS Wiki
imported>Ahoneybun
Init draft
 
Removed the duplicate 'tips and tricks' section and moved the package exclusion section right after enabling autologin.
 
(16 intermediate revisions by 9 users not shown)
Line 1: Line 1:
COSMIC is a desktop environment developed in the Rust programming language, using the iced cross platform GUI library for Rust, and Smithay as building blocks for its compositor, cosmic-comp. Cosmic-comp is comparable to smithay's own anvil compositor demonstration, just like the Wayland project uses Weston as demo compositor.
COSMIC is a [[:Category:Desktop environment|desktop environment]] developed in the [[Rust]] programming language, using the iced cross platform GUI library for Rust, and Smithay as building blocks for its compositor, cosmic-comp. Cosmic-comp is comparable to smithay's own anvil compositor demonstration, just like the Wayland project uses Weston as demo compositor.


== Installation ==
COSMIC was primarily developed for use in the [https://pop.system76.com/ Pop!_OS] distribution.


Currently packaged in nixpkgs master/unstable are below:
== Installation (starting with NixOS 25.05) ==


=== COSMIC Comp ===
COSMIC support in nixpkgs is still in development. You can follow progress via [https://github.com/NixOS/nixpkgs/issues/259641 the tracking issue].


https://github.com/NixOS/nixpkgs/tree/nixos-unstable/pkgs/applications/window-managers/cosmic/comp
You can enable COSMIC on your NixOS system by setting the following configuration options: <syntaxhighlight lang="nix">{
  # Enable the COSMIC login manager
  services.displayManager.cosmic-greeter.enable = true;


=== COSMIC Panel ===
  # Enable the COSMIC desktop environment
  services.desktopManager.cosmic.enable = true;
}</syntaxhighlight>Support for automatic logins is present when using the `cosmic-greeter` login manager. All you need is the following configuration: <syntaxhighlight lang="nix">
{
  services.displayManager.autoLogin = {
    enable = true;
    # Replace `yourUserName` with the actual username of user who should be automatically logged in
    user = "yourUserName";
  };
}
</syntaxhighlight>Alternatively, there is a [https://github.com/lilyinstarlight/nixos-cosmic flake] to setup COSMIC on NixOS.


This also includes the Dock:
=== Excluding COSMIC applications ===


https://github.com/NixOS/nixpkgs/tree/nixos-unstable/pkgs/applications/window-managers/cosmic/panel
To exclude certain applications that are installed by default with COSMIC, set the {{nixos:option|environment.cosmic.excludePackages}} module option (only available in 25.11):


=== COSMIC Applet ===
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
  environment.cosmic.excludePackages = with pkgs; [
    cosmic-edit
  ];
</nowiki>}}


https://github.com/NixOS/nixpkgs/tree/nixos-unstable/pkgs/applications/window-managers/cosmic/applets
== Tips and tricks ==
Since COSMIC is a new desktop environment and only has a beta release, there are some nuances that not everyone is familiar with. This section will contain as many as the maintainers are aware of.


=== COSMIC Settings ===
=== Clipboard ===
Due to the security concerns, Wayland defaults to the behaviour where only the focused client (window) can set the clipboard. Clipboard ownership is tied tightly to the focused client so that a background application cannot replace the clipboard contents. The intention from Wayland protocols is to improve security. But that can be an issue if you are either using a clipboard manager or perform rapid copy pasting in the terminal (like using macros in vi).


https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/window-managers/cosmic/settings
This security measure can be '''bypassed'''. by enabling the '''unstable''' [https://wayland.app/protocols/wlr-data-control-unstable-v1#zwlr_data_control_manager_v1 zwlr_data_control_manager_v1] protocol. But please note that bypassing this security measure means that '''all windows now have access to the clipboard, globally'''. If that is a sacrifice you are willing to make, add the following to your NixOS configuration file:<syntaxhighlight lang="nix">{
  environment.sessionVariables.COSMIC_DATA_CONTROL_ENABLED = 1;
}</syntaxhighlight>


=== COSMIC Icons ===
=== Theming and Firefox ===
If you have attempted theming the appearance of the COSMIC DE but don't see it reflected in Firefox, that is because Firefox is using the libadwaita theme. That behaviour needs to be disabled. It can be achieved by setting the Firefox configuration option `widget.gtk.libadwaita-colors.enabled` to `false`. On NixOS, the declarative method to do that is the following:<syntaxhighlight lang="nix">{
  programs.firefox.preferences = {
    # disable libadwaita theming for Firefox
    "widget.gtk.libadwaita-colors.enabled" = false;
  };
}</syntaxhighlight>


https://github.com/NixOS/nixpkgs/tree/a10c1225467f721dedbaaa260c006d6d15c8c40b/pkgs/by-name/co/cosmic-icons
== Configuration ==
 
COSMIC stores its configuration in [https://github.com/ron-rs/ron Rusty Object Notation (RON)] files. By default, the system-wide configuration is used unless user-specific files are present.
Currently, NixOS does not provide declarative options for configuring COSMIC through the NixOS module system.
 
=== System-wide configuration ===
 
If no user configuration exists, COSMIC falls back to system-wide defaults. These configuration files are bundled with each cosmic package and are located in their respective <code>[package]/share/cosmic/</code> directories.
 
When COSMIC is enabled using the NixOS option <code>services.desktopManager.cosmic.enable = true;</code>, the <code>/share/cosmic</code> directories from the relevant packages are symlinked into <code>/run/current-system/sw</code>.
 
This allows COSMIC to locate and apply the default configurations at runtime.
 
=== User configuration ===
 
User configuration files are located in <code>~/.config/cosmic/</code>.
 
They override the system defaults when present, and are automatically created or updated when using the COSMIC Settings application.
 
=== Component-specific configuration ===
 
Each COSMIC component maintains its own configuration files. For example, the COSMIC Panel reads and stores its configuration at <code>~/.config/cosmic/com.system76.CosmicPanel.Panel</code>
Components can be configured by modifying these files directly. For instance, to place the Time and Notifications applets in the center of the COSMIC panel, create the following file:
 
{{file|3=
Some([
    "com.system76.CosmicAppletTime",
    "com.system76.CosmicAppletNotifications",
])
|name=~/.config/cosmic/com.system76.CosmicPanel.Panel/v1/plugins_center|lang=rust}}
 
Most configuration changes are applied immediately without needing to restart the session.
 
[[Category:Desktop environment]]

Latest revision as of 04:57, 27 September 2025

COSMIC is a desktop environment developed in the Rust programming language, using the iced cross platform GUI library for Rust, and Smithay as building blocks for its compositor, cosmic-comp. Cosmic-comp is comparable to smithay's own anvil compositor demonstration, just like the Wayland project uses Weston as demo compositor.

COSMIC was primarily developed for use in the Pop!_OS distribution.

Installation (starting with NixOS 25.05)

COSMIC support in nixpkgs is still in development. You can follow progress via the tracking issue.

You can enable COSMIC on your NixOS system by setting the following configuration options:

{
  # Enable the COSMIC login manager
  services.displayManager.cosmic-greeter.enable = true;

  # Enable the COSMIC desktop environment
  services.desktopManager.cosmic.enable = true;
}

Support for automatic logins is present when using the `cosmic-greeter` login manager. All you need is the following configuration:

{
  services.displayManager.autoLogin = {
    enable = true;
    # Replace `yourUserName` with the actual username of user who should be automatically logged in
    user = "yourUserName";
  };
}

Alternatively, there is a flake to setup COSMIC on NixOS.

Excluding COSMIC applications

To exclude certain applications that are installed by default with COSMIC, set the environment.cosmic.excludePackages module option (only available in 25.11):

❄︎ /etc/nixos/configuration.nix
  environment.cosmic.excludePackages = with pkgs; [
    cosmic-edit
  ];

Tips and tricks

Since COSMIC is a new desktop environment and only has a beta release, there are some nuances that not everyone is familiar with. This section will contain as many as the maintainers are aware of.

Clipboard

Due to the security concerns, Wayland defaults to the behaviour where only the focused client (window) can set the clipboard. Clipboard ownership is tied tightly to the focused client so that a background application cannot replace the clipboard contents. The intention from Wayland protocols is to improve security. But that can be an issue if you are either using a clipboard manager or perform rapid copy pasting in the terminal (like using macros in vi).

This security measure can be bypassed. by enabling the unstable zwlr_data_control_manager_v1 protocol. But please note that bypassing this security measure means that all windows now have access to the clipboard, globally. If that is a sacrifice you are willing to make, add the following to your NixOS configuration file:

{
  environment.sessionVariables.COSMIC_DATA_CONTROL_ENABLED = 1;
}

Theming and Firefox

If you have attempted theming the appearance of the COSMIC DE but don't see it reflected in Firefox, that is because Firefox is using the libadwaita theme. That behaviour needs to be disabled. It can be achieved by setting the Firefox configuration option `widget.gtk.libadwaita-colors.enabled` to `false`. On NixOS, the declarative method to do that is the following:

{
  programs.firefox.preferences = {
    # disable libadwaita theming for Firefox
    "widget.gtk.libadwaita-colors.enabled" = false;
  };
}

Configuration

COSMIC stores its configuration in Rusty Object Notation (RON) files. By default, the system-wide configuration is used unless user-specific files are present. Currently, NixOS does not provide declarative options for configuring COSMIC through the NixOS module system.

System-wide configuration

If no user configuration exists, COSMIC falls back to system-wide defaults. These configuration files are bundled with each cosmic package and are located in their respective [package]/share/cosmic/ directories.

When COSMIC is enabled using the NixOS option services.desktopManager.cosmic.enable = true;, the /share/cosmic directories from the relevant packages are symlinked into /run/current-system/sw.

This allows COSMIC to locate and apply the default configurations at runtime.

User configuration

User configuration files are located in ~/.config/cosmic/.

They override the system defaults when present, and are automatically created or updated when using the COSMIC Settings application.

Component-specific configuration

Each COSMIC component maintains its own configuration files. For example, the COSMIC Panel reads and stores its configuration at ~/.config/cosmic/com.system76.CosmicPanel.Panel Components can be configured by modifying these files directly. For instance, to place the Time and Notifications applets in the center of the COSMIC panel, create the following file:

≡︎ ~/.config/cosmic/com.system76.CosmicPanel.Panel/v1/plugins_center
Some([
    "com.system76.CosmicAppletTime",
    "com.system76.CosmicAppletNotifications",
])

Most configuration changes are applied immediately without needing to restart the session.