feature: Add automated colorscheme switching to Ghostty, refactor

watchman_tmux into generic utility function.
This commit is contained in:
Martin Larsson 2025-07-25 11:44:53 +02:00
parent 6521dedbaa
commit a15f2238aa
7 changed files with 164 additions and 68 deletions

View file

@ -35,7 +35,10 @@ clipboard-paste-protection = false
window-decoration = false
shell-integration = zsh
theme = Ayu Mirage
# This is the default fallback theme. This is only used
# if the colorsync handled theme file doesn't exist.
theme = Ayu
config-file = ?colorsync_ghostty_theme
background-opacity = 1.0
background-blur-radius = 7

37
ghostty/ghostty-change-theme.sh Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
THEME=$(colorsync get)
OUTPUT="$HOME/.config/ghostty/colorsync_ghostty_theme"
default() {
printf "theme = Ayu" > "$OUTPUT"
}
case "$THEME" in
ayudark)
default
;;
ayumirage)
printf "theme = Ayu Mirage" > "$OUTPUT"
;;
ayulight)
printf "theme = ayu_light" > "$OUTPUT"
;;
*)
default
;;
esac
# once SIGUSR2 is merged in Ghostty, just replace the keystroke hack with pkill -USR2 ghostty
case "$(uname)" in
Darwin)
osascript -e 'tell application "System Events" to keystroke "," using {command down, shift down}'
;;
Linux)
wtype -M ctrl -M shift , -m shift -m ctrl
;;
*)
echo "Unsupported OS"
;;
esac