From 59dc5d1b3af2df6f95003f51781b7ee0f6fd5683 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 21 Oct 2018 11:25:34 -0400 Subject: [PATCH] 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. --- .config/polybar/launch.sh | 3 +++ .config/sxhkd/sxhkdrc | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.config/polybar/launch.sh b/.config/polybar/launch.sh index e035692..06561f4 100644 --- a/.config/polybar/launch.sh +++ b/.config/polybar/launch.sh @@ -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 diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 014ab62..ce8d8ff 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -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