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

59 lines
1.7 KiB
Bash
Raw Normal View History

#!/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')"
export BAR_HEIGHT=40
export BAR_ON_TOP=0
export BAR_SIDE_MARGIN=200
2017-04-14 11:52:18 -05:00
MONITOR_WIDTH=$(xrandr | grep "$BAR_MONITOR" | grep -Po ' \d+' | head -n 1)
2017-07-27 13:00:48 -05:00
export BAR_FONT=$(xrdb -query | sed -ne 's/.*font:\s*xft:\([^:]*\)\:.*$/\1/p' | head -n 1)
export BAR_ICON_FONT="Font Awesome 5 Free"
export BAR_ICON_FONT_2="Font Awesome 5 Brands"
2017-07-27 13:00:48 -05:00
export BAR_FONT_SIZE=$(xrdb -query | sed -ne 's/.*font:\s*xft:[^-]*\=\([0-9]*\).*$/\1/p' | head -n 1)
2017-04-14 11:52:18 -05:00
export BAR_ICON_FONT_SIZE=$((BAR_FONT_SIZE))
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
export BAR_BOTTOM="false"
export BAR_VERTICAL_MARGIN=0
2017-04-14 11:52:18 -05:00
export POS_Y=0
2017-04-14 07:43:57 -05:00
# allow a per-device config to override options
if [ -f "$HOME/.env_bar" ]; then
source "$HOME/.env_bar"
fi
2017-07-27 13:00:48 -05:00
export BAR_FONT_DECLARATION="${BAR_FONT}:pixelsize=${BAR_FONT_SIZE};1"
export BAR_ICON_FONT_DECLARATION="${BAR_ICON_FONT}:pixelsize=${BAR_ICON_FONT_SIZE};1"
export BAR_ICON_FONT_2_DECLARATION="${BAR_ICON_FONT_2}:pixelsize=${BAR_ICON_FONT_SIZE};1"
2017-07-27 13:00:48 -05:00
export BAR_WIDTH=$((MONITOR_WIDTH - GAP - GAP - BAR_SIDE_MARGIN - BAR_SIDE_MARGIN))
export POS_X=$((GAP + BAR_SIDE_MARGIN))
export EHEIGHT=$((BAR_HEIGHT + GAP + BAR_VERTICAL_MARGIN))
# if we just want the variables set here, pass an argument
if [ $# -gt 0 ]; then
return
fi
if [ $BAR_ON_TOP -eq 1 ]; then
export BAR_BOTTOM="false"
export POS_Y=$GAP
2017-03-02 16:41:39 -06:00
bspc config -m ${BAR_MONITOR} top_padding "$EHEIGHT"
bspc config -m ${BAR_MONITOR} bottom_padding "0"
else
2017-05-03 13:31:10 -05:00
export BAR_BOTTOM="true"
export POS_Y=$GAP
bspc config -m ${BAR_MONITOR} top_padding "0"
2017-03-02 16:41:39 -06:00
bspc config -m ${BAR_MONITOR} bottom_padding "$EHEIGHT"
fi
2017-02-20 18:38:20 -06:00
# bspc
polybar lytedev