diff --git a/.config/alacritty/switch_bg.py b/.config/alacritty/switch_bg.py index 638f9a3..328cf79 100755 --- a/.config/alacritty/switch_bg.py +++ b/.config/alacritty/switch_bg.py @@ -1,13 +1,17 @@ #!/usr/bin/python3 import os +import sys +action = 'switch' +if len(sys.argv) > 1: + action = sys.argv[1] path = os.path.join(os.getenv('HOME'), '.config/alacritty/alacritty.yml') with open(path, 'r+') as f: cfg = f.read() - if "colors: *dark" in cfg: + if "colors: *dark" in cfg and action in ['switch', 'light']: cfg = cfg.replace("colors: *dark", "colors: *light") - else: + elif "colors: *light" in cfg and action in ['switch', 'dark']: cfg = cfg.replace("colors: *light", "colors: *dark") f.seek(0) f.write(cfg) diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc index 9b47f9f..1fccfef 100755 --- a/.config/bspwm/bspwmrc +++ b/.config/bspwm/bspwmrc @@ -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 diff --git a/.config/bspwm/commands.sh b/.config/bspwm/commands.sh new file mode 100644 index 0000000..72c2954 --- /dev/null +++ b/.config/bspwm/commands.sh @@ -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 < /dev/null; then + sxhkd & + xsetroot -cursor_name left_ptr + exec bspwm +fi exec /usr/bin/i3 dwm-clock & exec /usr/local/bin/dwm