A one-button panel applet for the COSMIC desktop that switches between dark and light mode and shows you which one is active.
| Light mode | Dark mode |
|---|---|
![]() |
![]() |
- ◐ — light mode is active; click to switch to dark
- ◑ — dark mode is active; click to switch to light
It watches COSMIC's theme-mode config, so the glyph also flips when the mode is changed from Settings → Desktop → Appearance or by the sunrise/sunset auto-switch, not only when you click it.
Right-click opens a small menu: a dark/light switch, every theme file found on disk (with a check on the one currently applied), and a reset-to-COSMIC-default entry. Picking a theme applies it the same way Settings → Import does — the mode switches to match the theme's palette, and your transparency/frosted-glass settings are kept.
Theme files are the .ron exports COSMIC itself uses — what Settings → Appearance
exports, what cosmic-themes.org serves, and what
Tweaks for COSMIC saves. Drop them in
~/.local/share/themes/cosmic/
(/usr/share/themes/cosmic/ is also searched, as is the Tweaks flatpak's sandboxed
copy of that directory). The file name is the theme name.
contrib/cosmic-theme-from-emacs.el converts any installed Emacs theme into a theme
file, so the desktop can match the editor:
emacs --batch -l contrib/cosmic-theme-from-emacs.el -f cosmic-theme-from-emacs-batch \
doom-tomorrow-day doom-tomorrow-night modus-vivendiIt reads the theme's face colours (default, mode-line, link/cursor,
success/warning/error; doom themes' own bg-alt/highlight where present),
decides dark or light from the background, and writes
~/.local/share/themes/cosmic/<theme>.ron on top of COSMIC's stock palette — the same
recipe as the themes on cosmic-themes.org. Themes are located through your package
directories (elpa/, straight/build/) without loading your init file; pass -L DIR
for themes elsewhere. Pair it with something like
auto-dark in Emacs and both directions
stay in sync.
The same binary doubles as a CLI, handy for keyboard shortcuts:
cosmic-ext-applet-theme-toggle --list # themes found, with dark/light and path
cosmic-ext-applet-theme-toggle --apply "Dracula" # apply one by nameRequires a Rust toolchain and the usual libcosmic build dependencies
(libxkbcommon-dev, libwayland-dev, pkg-config on Debian/Ubuntu/Pop!_OS).
git clone https://github.com/ransomts/cosmic-ext-applet-theme-toggle
cd cosmic-ext-applet-theme-toggle
cargo build --release
# per-user
install -Dm0755 target/release/cosmic-ext-applet-theme-toggle ~/.local/bin/cosmic-ext-applet-theme-toggle
install -Dm0644 res/io.github.ransomts.CosmicAppletThemeToggle.desktop ~/.local/share/applications/io.github.ransomts.CosmicAppletThemeToggle.desktop
# or system-wide
sudo install -Dm0755 target/release/cosmic-ext-applet-theme-toggle /usr/bin/cosmic-ext-applet-theme-toggle
sudo install -Dm0644 res/io.github.ransomts.CosmicAppletThemeToggle.desktop /usr/share/applications/io.github.ransomts.CosmicAppletThemeToggle.desktopIf you have just: just build-release && sudo just install
(or just prefix=~/.local install for a per-user install).
Then add Theme Toggle to your panel in Settings → Desktop → Panel → Configure panel applets.
COSMIC keeps the mode in a single config file,
~/.config/cosmic/com.system76.CosmicTheme.Mode/v1/is_dark (true or false). The applet
writes that file through cosmic-config and subscribes to changes on it, the same way
COSMIC's own settings daemon and apps do.
Applying a theme writes the ThemeBuilder to com.system76.CosmicTheme.{Dark,Light}.Builder
and the built Theme to com.system76.CosmicTheme.{Dark,Light} — the same two configs
Settings and Tweaks write. Nothing else is stored; the theme list is rescanned each time
the menu opens.
Menu actions close the menu first and apply ~300 ms later. Changing the theme while an
applet popup is still mapped makes cosmic-panel stop compositing its applets until it is
restarted (observed on COSMIC 1.8 / Pop!_OS 24.04); the delay sidesteps that.
If auto switch (sunrise/sunset) is enabled in Settings, a click is a temporary override until the next transition — same as toggling in Settings.
GPL-3.0-only. The panel-button layout mirrors cosmic-panel-button from
pop-os/cosmic-applets.

