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
|
2024-03-14 22:36:48 +00:00
|
|
|
chosen=$(printf '%s\n' "${theme_options[@]}" | rofi -dmenu -p "Theme" -theme-str "configuration {show-icons:false;}")
|
2024-03-15 21:21:25 +00:00
|
|
|
|
|
|
|
if [[ $chosen == "" ]]; then
|
|
|
|
exit 0
|
2024-03-14 19:52:10 +00:00
|
|
|
fi
|
2024-02-23 23:04:39 +00:00
|
|
|
theme=$(echo "${chosen}" | rev | cut -d- -f2- | rev)
|
2024-02-17 14:18:08 +00:00
|
|
|
|
2024-03-16 23:20:36 +00:00
|
|
|
tmux_bg=$(echo "${chosen}" | awk -F'-' '{print $NF}')
|
2024-02-23 23:04:39 +00:00
|
|
|
|
2024-02-17 14:18:08 +00:00
|
|
|
# change rofi theme
|
2024-03-14 19:52:10 +00:00
|
|
|
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
|
2024-03-16 23:20:36 +00:00
|
|
|
sed -i "s/\(@import \"~\/.config\/rofi\/colors\/\).*/\1${theme}-${tmux_bg}.rasi\"/" $rofi_conf
|
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
|
2024-03-16 23:20:36 +00:00
|
|
|
sed -i "s/\(local background = \).*/\1\"${tmux_bg}\"/" ~/.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"
|
2024-03-16 23:20:36 +00:00
|
|
|
sed -i "s/#include \".*\"/#include \"${xresources_themes}\/${theme}-${tmux_bg}\"/" ~/.Xresources
|
2024-02-23 23:04:39 +00:00
|
|
|
xrdb ~/.Xresources
|
2024-02-23 21:12:18 +00:00
|
|
|
|
2024-03-14 19:52:10 +00:00
|
|
|
# change tmux
|
|
|
|
# add case for when tmux is not running
|
2024-03-16 23:20:36 +00:00
|
|
|
tmux_bg=$(xrdb -get background)
|
|
|
|
tmux_fg=$(xrdb -get foreground)
|
|
|
|
sed -i "s/set -g status-style 'bg=.* fg=.*'/set -g status-style 'bg=${tmux_bg} fg=${tmux_fg}'/" ~/.config/tmux/tmux.conf
|
2024-03-14 19:52:10 +00:00
|
|
|
tmux source "$HOME/.config/tmux/tmux.conf"
|
|
|
|
|
|
|
|
# change dunst
|
2024-03-16 23:20:36 +00:00
|
|
|
dunst_template=~/.config/dunst/template
|
|
|
|
dunst_conf=~/.config/dunst/dunstrc
|
|
|
|
dunst_bg=$(xrdb -get background)
|
|
|
|
dunst_fg=$(xrdb -get foreground)
|
|
|
|
dunst_red=$(xrdb -get color1)
|
|
|
|
cp "${dunst_template}" "${dunst_conf}"
|
|
|
|
sed -i "s/\${bg}/${dunst_bg}/" "${dunst_conf}"
|
|
|
|
sed -i "s/\${fg}/${dunst_fg}/" "${dunst_conf}"
|
|
|
|
sed -i "s/\${color1}/${dunst_red}/" "${dunst_conf}"
|
|
|
|
systemctl --user restart dunst.service
|
|
|
|
|
|
|
|
# NOTE: need to update fish theme for gruvbox
|
2024-03-14 19:52:10 +00:00
|
|
|
|
|
|
|
# change fish
|
2024-03-14 22:36:48 +00:00
|
|
|
fish -c "echo 'y' | fish_config theme save '${chosen}'"
|
2024-03-14 19:52:10 +00:00
|
|
|
|
2024-03-14 22:36:48 +00:00
|
|
|
# maybe change gtk theme?? and discord??
|
2024-02-23 21:12:18 +00:00
|
|
|
|
2024-03-14 19:52:10 +00:00
|
|
|
# recompile i3
|
2024-03-14 22:37:38 +00:00
|
|
|
i3-msg -q restart
|