dotfiles/.local/share/scripts/theme-selector.sh

33 lines
963 B
Bash
Raw Normal View History

2024-02-17 14:18:08 +00:00
#!/bin/bash
# defaults
2024-02-23 21:12:18 +00:00
theme_options=(
"catppuccin-dark"
"gruvbox-material-dark"
"catppuccin-light"
"gruvbox-material-light"
)
2024-02-17 14:18:08 +00:00
2024-02-23 21:12:18 +00:00
# rofi script to get what theme to use
chosen=$(printf '%s\n' "${theme_options[@]}" | rofi -dmenu -p "Theme")
2024-02-23 21:12:18 +00:00
theme=$(echo "${chosen}" | rev | cut -d- -f2- | rev)
2024-02-17 14:18:08 +00:00
background=$(echo "${chosen}" | awk -F'-' '{print $NF}')
echo "Theme: ${theme}"
echo "Background: ${background}"
2024-02-17 14:18:08 +00:00
# change rofi theme
2024-02-23 21:12:18 +00:00
sed -i "s/\(@import \".config\/rofi\/colors\/\).*/\1${theme}-${background}.rasi\"/" ~/.config/rofi/config.rasi
2024-02-17 14:18:08 +00:00
# change neovim theme
sed -i "s/\(local color = \).*/\1\"${theme}\"/" ~/.config/nvim/lua/tsousa/plugins/colorscheme.lua
sed -i "s/\(local background = \).*/\1\"${background}\"/" ~/.config/nvim/lua/tsousa/plugins/colorscheme.lua
2024-02-23 21:12:18 +00:00
2024-02-17 14:18:08 +00:00
# change xresources
2024-02-23 21:12:18 +00:00
xresources_themes=".Xresources.d"
sed -i "s/#include \".*\"/#include \"~\/${xresources_themes}\/${theme}-${background}\"/" ~/.Xresources
xrdb ~/.Xresources
2024-02-23 21:12:18 +00:00