From 1fffc14cf75aff3ce4bfe9ff5bedf73f18dadf3e Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Thu, 15 Jan 2026 22:29:22 -0500 Subject: [PATCH] Setup script to listen for theme changes and call swap mode as needed --- bin/listen_theme_changes.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 bin/listen_theme_changes.sh diff --git a/bin/listen_theme_changes.sh b/bin/listen_theme_changes.sh new file mode 100755 index 0000000..b5952d9 --- /dev/null +++ b/bin/listen_theme_changes.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Directory where the script is located +SCRIPT_DIR="$(dirname "$(realpath "$0")")" +SWAP_MODE_SCRIPT="$SCRIPT_DIR/swap_mode.sh" + +# Listen for changes in the color-scheme setting +gsettings monitor org.gnome.desktop.interface color-scheme | while read -r line; do + # 'default' usually corresponds to light mode in GNOME + if [[ "$line" == *"default"* ]]; then + echo "Detected light mode change..." + "$SWAP_MODE_SCRIPT" light + + # 'prefer-dark' corresponds to dark mode + elif [[ "$line" == *"prefer-dark"* ]]; then + echo "Detected dark mode change..." + "$SWAP_MODE_SCRIPT" dark + fi +done