summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Guschin <guschin@altlinux.org>2024-08-13 18:58:13 +0400
committerAndrew Guschin <guschin@altlinux.org>2024-08-13 18:58:13 +0400
commit5452a15aafa411e4e3cb8f181068d64d3ec20861 (patch)
tree3cbdbf85293516e5d3d53455413f38863a4b0b8d
parentc1e4cb7cd1441bac1130d6b1c51803fec00b2834 (diff)
add switch-theme script and add shortcut for it in Hyprland
-rw-r--r--.config/hypr/hyprland.conf1
-rwxr-xr-x.local/bin/switch-theme13
2 files changed, 14 insertions, 0 deletions
diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf
index 0ec562d..d2761f6 100644
--- a/.config/hypr/hyprland.conf
+++ b/.config/hypr/hyprland.conf
@@ -166,4 +166,5 @@ binde = , XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
binde = , XF86MonBrightnessDown, exec, brightnessctl set 5%-
binde = , XF86MonBrightnessUp, exec, brightnessctl set 5%+
+binde = $mainMod, O, exec, switch-theme
binde = , Print, exec, grim -g "$(slurp)" - | wl-copy
diff --git a/.local/bin/switch-theme b/.local/bin/switch-theme
new file mode 100755
index 0000000..e0aab25
--- /dev/null
+++ b/.local/bin/switch-theme
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -efu
+
+readonly current=$(gsettings get org.gnome.desktop.interface color-scheme)
+case $current in
+ "'prefer-light'")
+ gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' ;;
+ "'prefer-dark'")
+ gsettings set org.gnome.desktop.interface color-scheme 'prefer-light' ;;
+ *)
+ printf "Unknown value '$current'" ;;
+esac