From 04f1e195d0ec476ed387cd5b6c51a43b51f49670 Mon Sep 17 00:00:00 2001 From: ktyl Date: Sat, 21 Aug 2021 17:57:24 +0100 Subject: [PATCH] read bar colours from xrdb --- .config/bspwm/autostart | 4 ++-- .config/bspwm/bspwmrc | 15 ++++++++++++--- .scripts/bar/launch | 21 +++++++++++++++++---- .scripts/bar/toggle | 11 ++++++++--- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.config/bspwm/autostart b/.config/bspwm/autostart index 85d5904..785c76e 100755 --- a/.config/bspwm/autostart +++ b/.config/bspwm/autostart @@ -3,12 +3,12 @@ sxhkd & # enable keybinds . $SCRIPTS/comp # mblur . $SCRIPTS/keeb # caps lock -> ctrl+esc -. $SCRIPTS/bar/launch # bar redshift -l 53:0 & # make our eyes less strained -mopdiy & # bops +mopidy & # bops xbanish & # fuck off cursor udiskie & # external drive management +dunst & # notifs #asusd-user & diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc index b983ef8..0f3964e 100755 --- a/.config/bspwm/bspwmrc +++ b/.config/bspwm/bspwmrc @@ -5,13 +5,22 @@ export BSPWM_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/bspwm" # theme colours . "${HOME}/.cache/wal/colors.sh" +# launch bar +. $SCRIPTS/bar/launch + bspc monitor --reset-desktops 1 2 3 4 5 6 7 8 9 0 -bspc config border_width 0 +bspc config border_width 0 bspc config window_gap 0 -bspc config top_padding 27 -bspc config bottom_padding 0 +visible=$CONFIG/polybar/.visible + +vpadding=0 +hpadding=0 +bspc config top_padding $vpadding +bspc config bottom_padding $vpadding +bspc config left_padding $hpadding +bspc config right_padding $hpadding bspc config split_ratio 0.52 bspc config borderless_monocle true diff --git a/.scripts/bar/launch b/.scripts/bar/launch index f3c55cf..6e6b0cc 100755 --- a/.scripts/bar/launch +++ b/.scripts/bar/launch @@ -1,7 +1,20 @@ #!/usr/bin/env bash +export BAR_VISIBILITY=$CONFIG/polybar/.visible +[[ -f $BAR_VISIBILITY ]] && rm $BAR_VISIBILITY + +# create a file to keep track of the bar's visibility +# file exists -> bar visible +# file doesnt exist -> bar hidden +#touch $BAR_VISIBILITY + +# terminate already running bar instances +killall -q polybar + +# wait until the processes have been shut down +while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done + +# launch bar polybar example & # launch bar -touch $CONFIG/polybar/visible # create a file to keep track of the bar's visibility - # file exists -> bar visible - # file doesnt exist -> bar hidden - + +#touch $BAR_VISIBILITY diff --git a/.scripts/bar/toggle b/.scripts/bar/toggle index 05ae68c..f7ac5f6 100755 --- a/.scripts/bar/toggle +++ b/.scripts/bar/toggle @@ -1,16 +1,21 @@ #!/usr/bin/env bash -visible=$CONFIG/polybar/visible +visible=$CONFIG/polybar/.visible barheight=27 +padding=0 if [ -f $visible ]; then - bspc config top_padding 0 polybar-msg cmd hide rm $visible else - bspc config top_padding 27 + #bspc config top_padding ((padding+$barheight)) polybar-msg cmd show + ((padding=padding+barheight)) touch $visible fi +bspc config top_padding $padding + + +