1
0
forked from extern/nix-config

sxhkd: Don't hardcode top_padding for polybar

Since launch.sh calculates all the bar values for us (as well as bspwm
settings), we can simply store the top_padding value in the user's cache
directory, then reference that number within sxhkd.

This way, if the top_padding value is changed through launch.sh, editing
sxhkdrc manually isn't needed, and the config file doesn't need to be
reloaded.
This commit is contained in:
Donovan Glover 2018-10-21 11:25:34 -04:00
parent 14fa7d6c52
commit 59dc5d1b3a
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
2 changed files with 4 additions and 1 deletions

View File

@ -43,6 +43,9 @@ offset-y = ${POLYBAR_OFFSET_XY:-0}
border-size = ${POLYBAR_BORDER_SIZE:-0}
EOL
# Save the top_padding amount for use by other scripts
echo $BSPWM_TOP_PADDING > $HOME/.cache/polybar/bspwm_top_padding
# Wait until there are no more polybar instances running
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done

View File

@ -21,7 +21,7 @@ super + {_,shift} + backslash
super + o
(xdotool search --class --onlyvisible "Polybar" && \
(xdo hide -N "Polybar" && bspc config top_padding 0)) || \
(xdo show -N "Polybar" && bspc config top_padding 80)
(xdo show -N "Polybar" && bspc config top_padding $(cat ~/.cache/polybar/bspwm_top_padding))
# Change the wal color scheme
alt + m