#!/usr/bin/env bash xfile="$HOME/.Xresources" theme="$(printf "cyan\nmagenta" | rofi -dmenu -i -p "Theme" -l 2)" case "$theme" in cyan) bg="#071616" bunfoc="#353234" bfoc="#144949" dselb="#144949" ;; magenta) bg="#211019" bunfoc="#2d060e" bfoc="#4c1139" dselb="#4c1139" ;; *) exit;; esac sed -i \ -e "s/\*\.background:.*/\*\.background: $bg/" \ -e "s/\*\.border_unfocused:.*/\*\.border_unfocused: $bunfoc/" \ -e "s/\*\.border_focused:.*/\*\.border_focused: $bfoc/" \ -e "s/dmenu\.selbackground:.*/dmenu\.selbackground: $dselb/" \ $xfile # get colors xrdb "$xfile" fg=$(xrdb -query | awk '/\*.foreground/ { printf $2 }') bg=$(xrdb -query | awk '/\*.background/ { printf $2 }') bfoc=$(xrdb -query | awk '/\*.border_focused/ { printf $2 }') # black=$(xrdb -query | awk '/color0/ { printf $2 }') # red=$(xrdb -query | awk '/color1:/ { printf $2 }') # green=$(xrdb -query | awk '/color2/ { printf $2 }') # yellow=$(xrdb -query | awk '/color3/ { printf $2 }') # blue=$(xrdb -query | awk '/color4/ { printf $2 }') # magenta=$(xrdb -query | awk '/color5/ { printf $2 }') # cyan=$(xrdb -query | awk '/color6/ { printf $2 }') # white=$(xrdb -query | awk '/color7/ { printf $2 }') # dunst sed -i \ -e "s/^\s*foreground.*/ foreground = \"$fg\"/" \ -e "s/^\s*background.*/ background = \"$bg\"/" \ -e "s/^\s*frame_color.*/ frame_color = \"$bfoc\"/" \ ~/.config/dunst/dunstrc # rofi sed -i \ -e "s/foreground:.*/foreground: ${fg};/" \ -e "s/background:.*/background: ${bg};/" \ -e "s/maincolor:.*/maincolor: ${bfoc};/" \ ~/.config/rofi/theme.rasi bspc wm -r notify-send "Theme changed!"