Setup script to listen for theme changes and call swap mode as needed
This commit is contained in:
parent
cc70db25c6
commit
1fffc14cf7
1 changed files with 19 additions and 0 deletions
19
bin/listen_theme_changes.sh
Executable file
19
bin/listen_theme_changes.sh
Executable file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue