dunst theme selector

This commit is contained in:
Tiago Sousa 2024-03-16 23:20:36 +00:00
parent 867117f297
commit 7aea1d23b3
Signed by: tiago
SSH key fingerprint: SHA256:odOD9vln9U7qNe1R8o3UCbE3jkQCkr5/q5mgd5hwua0
3 changed files with 41 additions and 16 deletions

View file

@ -1,22 +1,18 @@
[global]
frame_color = "#8AADF4"
frame_color = "#D4BE98"
background = "#282828"
foreground = "#D4BE98"
separator_color= frame
width = (200,370)
height = 350
font = Roboto Mono Nerd Font 9
[urgency_low]
background = "#24273A"
foreground = "#CAD3F5"
timeout = 3
[urgency_normal]
background = "#24273A"
foreground = "#CAD3F5"
timeout = 5
[urgency_critical]
background = "#24273A"
foreground = "#CAD3F5"
frame_color = "#F5A97F"
frame_color = "#EA6962"
timeout = 10

18
.config/dunst/template Normal file
View file

@ -0,0 +1,18 @@
[global]
frame_color = "${fg}"
background = "${bg}"
foreground = "${fg}"
separator_color= frame
width = (200,370)
height = 350
font = Roboto Mono Nerd Font 9
[urgency_low]
timeout = 3
[urgency_normal]
timeout = 5
[urgency_critical]
frame_color = "${color1}"
timeout = 10

View file

@ -16,7 +16,7 @@ if [[ $chosen == "" ]]; then
fi
theme=$(echo "${chosen}" | rev | cut -d- -f2- | rev)
background=$(echo "${chosen}" | awk -F'-' '{print $NF}')
tmux_bg=$(echo "${chosen}" | awk -F'-' '{print $NF}')
# change rofi theme
rofi_conf=~/.config/rofi/config.rasi
@ -25,26 +25,37 @@ 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
sed -i "s/\(@import \"~\/.config\/rofi\/colors\/\).*/\1${theme}-${tmux_bg}.rasi\"/" $rofi_conf
# 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
sed -i "s/\(local background = \).*/\1\"${tmux_bg}\"/" ~/.config/nvim/lua/tsousa/plugins/colorscheme.lua
# change xresources
xresources_themes=".Xresources.d"
sed -i "s/#include \".*\"/#include \"${xresources_themes}\/${theme}-${background}\"/" ~/.Xresources
sed -i "s/#include \".*\"/#include \"${xresources_themes}\/${theme}-${tmux_bg}\"/" ~/.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_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
tmux source "$HOME/.config/tmux/tmux.conf"
# change dunst
# NOTE: need to change fish theme for gruvbox
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
# change fish
fish -c "echo 'y' | fish_config theme save '${chosen}'"