theme related stuff

This commit is contained in:
Tiago Sousa 2024-03-14 19:52:10 +00:00
parent b03e5af9cb
commit fdf3f567e5
Signed by: tiago
SSH key fingerprint: SHA256:odOD9vln9U7qNe1R8o3UCbE3jkQCkr5/q5mgd5hwua0
23 changed files with 461 additions and 478 deletions

31
.local/share/scripts/theme-selector.sh Normal file → Executable file
View file

@ -10,15 +10,21 @@ theme_options=(
# rofi script to get what theme to use
chosen=$(printf '%s\n' "${theme_options[@]}" | rofi -dmenu -p "Theme")
if [[ -z $chosen ]]; then
exit 1
fi
theme=$(echo "${chosen}" | rev | cut -d- -f2- | rev)
background=$(echo "${chosen}" | awk -F'-' '{print $NF}')
echo "Theme: ${theme}"
echo "Background: ${background}"
# change rofi theme
sed -i "s/\(@import \".config\/rofi\/colors\/\).*/\1${theme}-${background}.rasi\"/" ~/.config/rofi/config.rasi
rofi_conf=~/.config/rofi/config.rasi
rofi_theme_check="${rofi_conf}"/"${chosen}".rasi
if [[ -f $rofi_theme_check ]]; then
echo "Rofi Theme ${chosen} not found"
exit 1
fi
sed -i "s/\(@import \"~\/.config\/rofi\/colors\/\).*/\1${theme}-${background}.rasi\"/" $rofi_conf
# change neovim theme
sed -i "s/\(local color = \).*/\1\"${theme}\"/" ~/.config/nvim/lua/tsousa/plugins/colorscheme.lua
@ -26,7 +32,22 @@ sed -i "s/\(local background = \).*/\1\"${background}\"/" ~/.config/nvim/lua/tso
# change xresources
xresources_themes=".Xresources.d"
sed -i "s/#include \".*\"/#include \"~\/${xresources_themes}\/${theme}-${background}\"/" ~/.Xresources
sed -i "s/#include \".*\"/#include \"${xresources_themes}\/${theme}-${background}\"/" ~/.Xresources
xrdb ~/.Xresources
# change tmux
# add case for when tmux is not running
tmux_background=$(grep "^*.background" ~/"${xresources_themes}"/"${theme}"-"${background}" | awk '{print $2}')
tmux_foreground=$(grep "^*.foreground" ~/"${xresources_themes}"/"${theme}"-"${background}" | awk '{print $2}')
sed -i "s/set -g status-style 'bg=.* fg=.*'/set -g status-style 'bg=${tmux_background} fg=${tmux_foreground}'/" ~/.config/tmux/tmux.conf
tmux source "$HOME/.config/tmux/tmux.conf"
# change dunst
# change fish
fish_config theme choose "$chosen"
# maybe change gtk theme??
# recompile i3
i3-msg restart