This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/de/bar/bar.bash
2017-04-14 11:52:18 -05:00

46 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
export BAR_MONITOR="$(polybar --list-monitors | tail -n 1 | sed -n 's/^\s*\(.*\):.*$/\1/p')"
export BAR_HEIGHT=40
export BAR_ON_TOP=0
export BAR_SIDE_MARGIN=200
MONITOR_WIDTH=$(xrandr | grep "$BAR_MONITOR" | grep -Po ' \d+' | head -n 1)
export BAR_FONT=$(xrdb -query | sed -ne 's/.*font:\s*xft:\([^-]*\)\-.*$/\1/p' | head -n 1)
export BAR_ICON_FONT="FontAwesome"
export BAR_FONT_SIZE=$(xrdb -query | sed -ne 's/.*font:\s*xft:[^-]*\-\([0-9]*\).*$/\1/p' | head -n 1)
export BAR_ICON_FONT_SIZE=$((BAR_FONT_SIZE))
export BAR_FONT_DECLARATION="${BAR_FONT}:size=${BAR_FONT_SIZE};1"
export BAR_ICON_FONT_DECLARATION="${BAR_ICON_FONT}:size=${BAR_ICON_FONT_SIZE};1"
export GAP=$(bspc wm -d | grep -Po '(windowGap.*?,)' | grep -Po '\d*' | head -n 1)
export BAR_BOTTOM="true"
export POS_Y=0
# allow a per-device config to override options
if [ -f "$HOME/.env_bar" ]; then
source "$HOME/.env_bar"
fi
export BAR_WIDTH=$((MONITOR_WIDTH - GAP - GAP - BAR_SIDE_MARGIN - BAR_SIDE_MARGIN))
export POS_X=$((GAP + BAR_SIDE_MARGIN))
EHEIGHT=$((BAR_HEIGHT + GAP))
if [ $BAR_ON_TOP -eq 1 ]; then
export BAR_BOTTOM="false"
export POS_Y=$GAP
bspc config -m ${BAR_MONITOR} top_padding "$EHEIGHT"
bspc config -m ${BAR_MONITOR} bottom_padding "0"
else
export POS_Y=$GAP
bspc config -m ${BAR_MONITOR} top_padding "0"
bspc config -m ${BAR_MONITOR} bottom_padding "$EHEIGHT"
fi
# bspc
polybar lytedev