summary refs log tree commit diff
path: root/bin/luxnox-toggle
blob: eb727d306207291c0544e37a1f5889f79764ab5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
# Flip the system color scheme between dark (nox) and light (lux).
# Apps that follow org.gnome.desktop.interface color-scheme (kitty via the
# portal, GTK, later Emacs) switch on their own.
#   luxnox-toggle [dark|light]
key=org.gnome.desktop.interface
# Always the plain "user" dconf database, which the GTK portal reads. A shell
# started from a session that inherited COSMIC's DCONF_PROFILE would otherwise
# write to COSMIC's database and nothing would change.
unset DCONF_PROFILE
case "${1:-}" in
  dark)  want=prefer-dark ;;
  light) want=prefer-light ;;
  "")    [ "$(gsettings get $key color-scheme)" = "'prefer-dark'" ] \
           && want=prefer-light || want=prefer-dark ;;
  *)     echo "usage: luxnox-toggle [dark|light]" >&2; exit 2 ;;
esac
gsettings set $key color-scheme "$want"