configfiles/bspwm/.config/scripts/barhelp.sh

30 lines
544 B
Bash
Executable file

#!/bin/bash
D=$(xrandr | grep LVDS1 | grep -Eo '[0-9]+x[0-9]+')
DW=$(echo $D | cut -dx -f1)
DH=$(echo $D | cut -dx -f2)
bar() {
W=$1
H=$2
PADDING=$3
ANCHOR=$4
POS=$5
shift 5
case $ANCHOR in
T)
Y=$PADDING
;;
B|*)
Y=$(($DH - $PADDING - $H))
;;
esac
[ "$POS" -gt 100 ] && POS=100
[ "$POS" -lt 0 ] && POS=0
X=$(( ($DW - $W - 2 * $PADDING) * $POS / 100 + $PADDING ))
dzen2 -x "$X" -y "$Y" -w "$W" -h "$H" "$@" -e "onstart=lower"
}