feat(theme): Add theme support

Add support for both pywal and theme.sh terminal themes
This commit is contained in:
Robert Morrison 2024-02-19 15:14:55 +00:00
parent 654a2ad327
commit 0100d1c64f
Signed by: robert
GPG Key ID: 73E012EB3F4EC696
2 changed files with 33 additions and 0 deletions

32
theme Normal file
View File

@ -0,0 +1,32 @@
# Attempt to load pywal theme first (unless disabled)
if has 'wal' ; then
if [[ -z $NO_PYWAL ]]; then
if [[ -e $XDG_CACHE_HOME/wal/sequences ]]; then
cat $XDG_CACHE_HOME/wal/sequences && return
fi
wal -qnR && return
fi
fi
# Load theme.sh theme uses theme_history to set
if has 'theme.sh'; then
# Load the last set theme automatically
[ -e ~/.config/.theme_history ] && theme.sh "$(theme.sh -l|tail -n1)"
# Toggle between last set themes
last_theme() {
theme.sh "$(theme.sh -l | tail -n2 | head -n1)"
}
zle -N last_theme
bindkey '^o' last_theme
alias th='theme.sh -i'
alias thl='theme.sh --light -i'
alias thd='theme.sh --dark -i'
fi
# vim: ft=zsh

1
zshrc
View File

@ -37,6 +37,7 @@ source ${ZDOTDIR}/prompt
source ${ZDOTDIR}/keyboard
source ${ZDOTDIR}/history
source ${ZDOTDIR}/hooks
source ${ZDOTDIR}/theme
## Set options