diff --git a/.config/polybar/config b/.config/polybar/config index 1c91c2fc..27789ce2 100644 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -13,45 +13,27 @@ text = ${xrdb:color7} background-alt = ${xrdb:color8} [bar/main] -inherit = bar/secondary - -# Make the bar float -# offset-x = offset-y = window_gap in bspwmrc -# width = screen resolution - offset-x * 2 -# border-size = border_width in bspwmrc -# border-bottom-size = border-size / 2 -# line-size = border-size / 2 -offset-x = 30 -offset-y = 30 -width = 3780 -border-size = 8 -border-bottom-size = 4 -line-size = 4 - -[bar/secondary] modules-left = bspwm modules-center = mpd modules-right = cpu ram volume date time monitor = VGA-1 +wm-restack = bspwm +include-file = $HOME/.cache/polybar/config + foreground = ${color.text} background = ${color.background} +border-color = ${color.text} + font-0 = "Fira Mono:style=Bold:size=19" font-1 = "Noto Sans CJK JP:size=19" font-2 = "Font Awesome 5 Free:style=Solid:size=19" font-3 = "Font Awesome 5 Free:style=Regular:size=19" font-4 = "Font Awesome 5 Brands:style=Regular:size=19" -height = 80 padding-left = 2 padding-right = 2 module-margin = 1 -border-color = ${color.background-alt} -border-bottom-size = 4 -# line-size = 4 - -# Make fullscreen programs show above polybar -wm-restack = bspwm [module/bspwm] type = internal/bspwm diff --git a/.config/polybar/launch.sh b/.config/polybar/launch.sh index fa2c00f7..d4a40c1f 100644 --- a/.config/polybar/launch.sh +++ b/.config/polybar/launch.sh @@ -1,12 +1,50 @@ #!/bin/sh # New Start: A modern Arch workflow built with an emphasis on functionality. -# Copyright (C) 2017 Donovan Glover +# Copyright (C) 2017-2018 Donovan Glover # Terminate any previous instances of polybar killall -q polybar +bspc_config() { + bspc config top_padding $1 & + bspc config border_width $2 & + bspc config window_gap $3 & +} + +# If no bar was specified, we're done here. +if [ -z "$1" ]; then bspc_config 0 4 0; exit; fi + +# Set defaults +POLYBAR_HEIGHT=80 +HOST_WIDTH=3840 + +# Make the bar float +if [ "$1" == "float" ]; then + POLYBAR_BORDER_SIZE=8 # Later set to bspwm's border_width + POLYBAR_OFFSET_XY=30 # Later set to bspwm's window_gap + POLYBAR_WIDTH=$(($HOST_WIDTH - $POLYBAR_OFFSET_XY * 2)) +fi + +# Set the bspwm variables +BSPWM_TOP_PADDING=$(($POLYBAR_HEIGHT + ${POLYBAR_OFFSET_XY:-0} + ${POLYBAR_BORDER_SIZE:-0} * 2)) +BSPWM_BORDER_WIDTH=${POLYBAR_BORDER_SIZE:-8} +BSPWM_WINDOW_GAP=${POLYBAR_OFFSET_XY:-20} + +bspc_config $BSPWM_TOP_PADDING $BSPWM_BORDER_WIDTH $BSPWM_WINDOW_GAP + +# Make the polybar config +mkdir -p $HOME/.cache/polybar + +cat >$HOME/.cache/polybar/config </dev/null; do sleep 1; done # Start polybar -launch polybar secondary +launch polybar main