mirror of
https://github.com/MatMasIt/gnome-therminal-autotheme.git
synced 2025-12-13 13:34:19 +01:00
first commit
This commit is contained in:
54
sync-terminal-theme.sh
Executable file
54
sync-terminal-theme.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the default profile UUID
|
||||
PROFILE_ID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
|
||||
PROFILE_PATH="/org/gnome/terminal/legacy/profiles:/:$PROFILE_ID"
|
||||
|
||||
# Define themes
|
||||
set_dark_theme() {
|
||||
gsettings set org.gnome.Terminal.Legacy.Settings theme-variant 'dark'
|
||||
dconf write $PROFILE_PATH/use-theme-colors false
|
||||
dconf write $PROFILE_PATH/foreground-color "'#d4d4d4'"
|
||||
dconf write $PROFILE_PATH/background-color "'#1e1e1e'"
|
||||
dconf write $PROFILE_PATH/palette "['#1e1e1e', '#f44747', '#619955', '#ffaf00', '#85dfff', '#d27bff', '#4EC9B0', '#d4d4d4', '#808080', '#f44747', '#619955', '#ffaf00', '#85dfff', '#d27bff', '#4EC9B0', '#ffffff']"
|
||||
dconf write $PROFILE_PATH/cursor-color "'#d4d4d4'"
|
||||
}
|
||||
|
||||
set_light_theme() {
|
||||
gsettings set org.gnome.Terminal.Legacy.Settings theme-variant 'light'
|
||||
dconf write $PROFILE_PATH/use-theme-colors false
|
||||
dconf write $PROFILE_PATH/foreground-color "'#000000'"
|
||||
dconf write $PROFILE_PATH/background-color "'#ffffff'"
|
||||
dconf write $PROFILE_PATH/palette "['#000000', '#cc0000', '#4e9a06', '#c4a000', '#3465a4', '#75507b', '#06989a', '#d3d7cf', '#555753', '#ef2929', '#8ae234', '#fce94f', '#729fcf', '#ad7fa8', '#34e2e2', '#eeeeec']"
|
||||
dconf write $PROFILE_PATH/cursor-color "'#000000'"
|
||||
}
|
||||
|
||||
update_terminal_theme() {
|
||||
SCHEME=$(gsettings get org.gnome.desktop.interface color-scheme)
|
||||
|
||||
if [[ "$SCHEME" == *"dark"* ]]; then
|
||||
set_dark_theme
|
||||
else
|
||||
set_light_theme
|
||||
fi
|
||||
}
|
||||
|
||||
# Check for manual arguments (light or dark)
|
||||
if [[ "${1:-}" == "light" ]]; then
|
||||
set_light_theme
|
||||
echo "[sync-script] Applied light theme manually."
|
||||
exit 0
|
||||
elif [[ "${1:-}" == "dark" ]]; then
|
||||
set_dark_theme
|
||||
echo "[sync-script] Applied dark theme manually."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run once immediately to apply based on the current GNOME theme
|
||||
update_terminal_theme
|
||||
|
||||
# Monitor and auto-update GNOME theme changes
|
||||
echo "[sync-script] Monitoring GNOME theme changes..."
|
||||
gsettings monitor org.gnome.desktop.interface color-scheme | while read -r; do
|
||||
update_terminal_theme
|
||||
done
|
||||
Reference in New Issue
Block a user