diff options
| author | skylar <me@casper> | 2026-11-01 07:03:26 -0800 |
|---|---|---|
| committer | skylar <me@casper> | 2026-11-01 07:03:26 -0800 |
| commit | 070a107873440d62b4519e6d91c2ba739d4b6fa2 (patch) | |
| tree | ae4e1c3540cdd01b3289ed6f96ec3ea69507f73e /bin/system-theme | |
Literate Doom Emacs configuration
config.org tangles to config.el, which loads private/config.el last when
it exists. bin/ holds the scripts some sections drive.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'bin/system-theme')
| -rwxr-xr-x | bin/system-theme | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/system-theme b/bin/system-theme new file mode 100755 index 0000000..862b243 --- /dev/null +++ b/bin/system-theme @@ -0,0 +1,29 @@ +#!/usr/bin/env sh +# Switch the COSMIC desktop between light and dark mode, and optionally the +# wallpaper with it: set SYSTEM_THEME_WALLPAPER_DARK and +# SYSTEM_THEME_WALLPAPER_LIGHT to image files. Emacs's auto-dark follows the +# desktop's mode on its own. On another desktop, this is the file to rewrite. + +COSMIC="${XDG_CONFIG_HOME:-$HOME/.config}/cosmic" + +set_wallpaper() { + [ -n "$1" ] || return 0 + wallpaper="$(realpath "$1")" || return 1 + sed -i 's|^.*source: Path(".*"),$| source: Path("'"$wallpaper"'"),|' \ + "$COSMIC/com.system76.CosmicBackground/v1/all" +} + +case "$1" in + dark) + echo "true" > "$COSMIC/com.system76.CosmicTheme.Mode/v1/is_dark" + set_wallpaper "${SYSTEM_THEME_WALLPAPER_DARK:-}" + ;; + light) + echo "false" > "$COSMIC/com.system76.CosmicTheme.Mode/v1/is_dark" + set_wallpaper "${SYSTEM_THEME_WALLPAPER_LIGHT:-}" + ;; + *) + echo "usage: system-theme dark|light" >&2 + exit 1 + ;; +esac |