summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/darkmode29
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/darkmode b/bin/darkmode
new file mode 100755
index 0000000..19d60eb
--- /dev/null
+++ b/bin/darkmode
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+set -e
+[ -n "$DEBUG" ] && set -x
+
+icons=/usr/share/icons/mdi/scalable
+
+case "${1}" in
+	daytime)
+		notify-send -i ${icons}/car-light-high.svg -a gamma "gamma: day" "switching to light theme"
+		gsettings set org.gnome.desktop.interface gtk-theme Adwaita
+		pkill -fe -USR1 waybar-gammastep
+		;;
+
+	night)
+		notify-send -i ${icons}/car-light-dimmed.svg -a gamma "gamma: night" "switching to dark theme"
+		gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark
+		pkill -fe -USR2 waybar-gammastep
+		;;
+
+	dusk | dawn)
+		# noop
+		# pkill -fe -USR2 waybar-gammastep
+		;;
+
+	*)
+		printf "usage: %s [night|daytime]\n" "$(basename "$(readlink -f -- "$0")")"
+		;;
+esac