2017-02-08 18:19:13 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-02-11 14:00:54 -06:00
|
|
|
export BAR_MONITOR="$(polybar --list-monitors | tail -n 1 | sed -n 's/^\s*\(.*\):.*$/\1/p')"
|
2019-07-24 11:23:18 -05:00
|
|
|
# export BAR_MONITOR="$(polybar --list-monitors | tail -n 2 | head -n 1 | sed -n 's/^\s*\(.*\):.*$/\1/p')"
|
2017-02-28 10:56:23 -06:00
|
|
|
export BAR_HEIGHT=40
|
2017-02-08 18:19:13 -06:00
|
|
|
export BAR_ON_TOP=0
|
|
|
|
export BAR_SIDE_MARGIN=200
|
|
|
|
|
2018-09-05 09:54:30 -05:00
|
|
|
export BAR_FONT="${BAR_FONT:-$(xrdb -query | sed -ne 's/.*font:\s*xft:\([^:]*\)\:.*$/\1/p' | head -n 1)}"
|
2018-10-23 14:59:04 -05:00
|
|
|
export BAR_ICON_FONT="${BAR_ICON_FONT:-"Font Awesome 5 Free"}"
|
2019-03-13 22:12:37 -05:00
|
|
|
export BAR_FONT_SIZE="${BAR_FONT_SIZE:-$(xrdb -query | sed -ne 's/.*font:\s*xft:[^-,]*\=\([0-9]*\).*$/\1/p' | head -n 1)}"
|
2018-09-05 09:54:30 -05:00
|
|
|
export BAR_ICON_FONT_SIZE="${BAR_ICON_FONT_SIZE:-$((BAR_FONT_SIZE))}"
|
2017-04-14 11:52:18 -05:00
|
|
|
|
2017-12-21 12:18:17 -06:00
|
|
|
export GAP=$(bspc wm -d | grep -Po '(windowGap.*?,)' | grep -Po '\-?\d*' | head -n 1)
|
|
|
|
|
|
|
|
if [ "$GAP" -lt 0 ]; then
|
|
|
|
GAP=0
|
|
|
|
fi
|
2017-04-14 11:52:18 -05:00
|
|
|
|
2017-04-17 12:24:01 -05:00
|
|
|
export BAR_BOTTOM="false"
|
2017-07-27 11:52:54 -05:00
|
|
|
export BAR_VERTICAL_MARGIN=0
|
2017-04-14 11:52:18 -05:00
|
|
|
export POS_Y=0
|
|
|
|
|
2020-01-17 03:02:53 -06:00
|
|
|
. maybe_source_env_file polybar
|
2017-04-14 07:43:57 -05:00
|
|
|
|
2019-10-16 11:19:06 -05:00
|
|
|
export MONITOR_WIDTH=$(xrandr | grep "^$BAR_MONITOR " | grep -Po ' \d+' | head -n 1)
|
|
|
|
|
2017-07-27 13:00:48 -05:00
|
|
|
export BAR_FONT_DECLARATION="${BAR_FONT}:pixelsize=${BAR_FONT_SIZE};1"
|
2018-10-23 14:59:04 -05:00
|
|
|
export BAR_ICON_FONT_DECLARATION="${BAR_ICON_FONT}:style=Solid:pixelsize=${BAR_ICON_FONT_SIZE};1"
|
|
|
|
export BAR_ICON_FONT_2_DECLARATION="${BAR_ICON_FONT_2}:style=Regular:pixelsize=${BAR_ICON_FONT_SIZE};1"
|
2017-07-27 13:00:48 -05:00
|
|
|
|
2017-02-08 18:19:13 -06:00
|
|
|
export BAR_WIDTH=$((MONITOR_WIDTH - GAP - GAP - BAR_SIDE_MARGIN - BAR_SIDE_MARGIN))
|
|
|
|
export POS_X=$((GAP + BAR_SIDE_MARGIN))
|
|
|
|
|
2017-07-27 11:52:54 -05:00
|
|
|
export EHEIGHT=$((BAR_HEIGHT + GAP + BAR_VERTICAL_MARGIN))
|
2017-04-20 08:16:02 -05:00
|
|
|
|
|
|
|
# if we just want the variables set here, pass an argument
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
return
|
|
|
|
fi
|
2017-02-08 18:19:13 -06:00
|
|
|
|
2018-11-12 15:50:01 -06:00
|
|
|
if [ "$BAR_ON_TOP" -eq 1 ]; then
|
2017-02-08 18:19:13 -06:00
|
|
|
export BAR_BOTTOM="false"
|
|
|
|
export POS_Y=$GAP
|
2018-11-12 15:50:01 -06:00
|
|
|
bspc config -m "${BAR_MONITOR}" top_padding "$EHEIGHT"
|
|
|
|
bspc config -m "${BAR_MONITOR}" bottom_padding "0"
|
2017-02-08 18:19:13 -06:00
|
|
|
else
|
2017-05-03 13:31:10 -05:00
|
|
|
export BAR_BOTTOM="true"
|
2017-02-08 18:19:13 -06:00
|
|
|
export POS_Y=$GAP
|
2018-11-12 15:50:01 -06:00
|
|
|
bspc config -m "${BAR_MONITOR}" top_padding "0"
|
|
|
|
bspc config -m "${BAR_MONITOR}" bottom_padding "$EHEIGHT"
|
2017-02-08 18:19:13 -06:00
|
|
|
fi
|
|
|
|
|
2017-02-20 18:38:20 -06:00
|
|
|
# bspc
|
2017-02-08 18:19:13 -06:00
|
|
|
|
2019-10-16 11:19:06 -05:00
|
|
|
echo "Monitor: $BAR_MONITOR"
|
|
|
|
echo "Bottom?: $BAR_BOTTOM"
|
|
|
|
echo "Dimensions: $POS_X $POS_Y $BAR_WIDTH $BAR_HEIGHT"
|
|
|
|
echo "EHeight: $EHEIGHT"
|
|
|
|
echo "Margin: $BAR_SIDE_MARGIN"
|
|
|
|
|
2017-02-08 18:19:13 -06:00
|
|
|
polybar lytedev
|