switch between global dark and light themes (super + F6)
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
sxhkd &
|
||||
|
||||
xdo kill $(xdo id -N Polybar)
|
||||
i=0
|
||||
monitors=$(bspc query -M --names)
|
||||
for monitor in $monitors; do
|
||||
@ -20,11 +19,9 @@ else
|
||||
fi
|
||||
|
||||
bspc config border_width 4
|
||||
bspc config window_gap 8
|
||||
bspc config window_gap 12
|
||||
|
||||
bspc config normal_border_color '#808080'
|
||||
bspc config focused_border_color '#3585ce'
|
||||
bspc config presel_feedback_color '#3585ce'
|
||||
sh ~/.config/bspwm/commands.sh dark-colors
|
||||
|
||||
bspc config split_ratio 0.50
|
||||
bspc config single_monocle true
|
||||
|
71
.config/bspwm/commands.sh
Normal file
71
.config/bspwm/commands.sh
Normal file
@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
|
||||
CMD="$1"
|
||||
shift
|
||||
|
||||
is_light() {
|
||||
bspc config focused_border_color | grep '#068c70' > /dev/null
|
||||
}
|
||||
|
||||
if [ "$CMD" = switch-colors ]; then
|
||||
if is_light; then
|
||||
CMD=dark-colors
|
||||
SCHEME=dark
|
||||
else
|
||||
CMD=light-colors
|
||||
SCHEME=light
|
||||
fi
|
||||
elif is_light; then
|
||||
SCHEME=light
|
||||
else
|
||||
SCHEME=dark
|
||||
fi
|
||||
|
||||
FONT=Iosevka:pixelsize=30
|
||||
if [ "$SCHEME" = light ]; then
|
||||
ROOT_BG=#c1e6c2
|
||||
BAR_BG=#e1e6d2
|
||||
BAR_FG=#1a343a
|
||||
BAR_ACTIVE=#b0decc
|
||||
BAR_URGENT=#9b0640
|
||||
BAR_EMPTY=#b0b0b0
|
||||
NORMAL_BORDER=#b0b0b0
|
||||
FOCUS_BORDER=#068c70
|
||||
EMACS_THEME=lupan-light
|
||||
else
|
||||
ROOT_BG=#343a1a
|
||||
BAR_BG=#1a343a
|
||||
BAR_FG=#f2f6e1
|
||||
BAR_ACTIVE=#3585ce
|
||||
BAR_URGENT=#9b0640
|
||||
BAR_EMPTY=#808080
|
||||
NORMAL_BORDER=#808080
|
||||
FOCUS_BORDER=#3585ce
|
||||
EMACS_THEME=lupan-dark-blue
|
||||
fi
|
||||
|
||||
switch_colors() {
|
||||
xrdb -merge <<EOF
|
||||
polybar.background: ${BAR_BG}
|
||||
polybar.foreground: ${BAR_FG}
|
||||
polybar.active: ${BAR_ACTIVE}
|
||||
polybar.urgent: ${BAR_URGENT}
|
||||
polybar.empty: ${BAR_EMPTY}
|
||||
EOF
|
||||
polybar-msg cmd restart
|
||||
xsetroot -solid "${ROOT_BG}"
|
||||
bspc config normal_border_color "${NORMAL_BORDER}"
|
||||
bspc config focused_border_color "${FOCUS_BORDER}"
|
||||
bspc config presel_feedback_color "${FOCUS_BORDER}"
|
||||
python ~/.config/alacritty/switch_bg.py "$SCHEME"
|
||||
emacsclient --eval "(my-select-theme '${EMACS_THEME})"
|
||||
}
|
||||
|
||||
case "$CMD" in
|
||||
light-colors|dark-colors)
|
||||
switch_colors
|
||||
;;
|
||||
dmenu|dmenu_run)
|
||||
exec "$CMD" -nb "${BAR_BG}" -nf "${BAR_FG}" -sb "${BAR_ACTIVE}" -sf "${BAR_FG}" -fn "$FONT" "$@"
|
||||
;;
|
||||
esac
|
Reference in New Issue
Block a user