diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index 4263f05b..d67b643d 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -25,11 +25,11 @@ 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" +font-0 = "Fira Mono:style=Bold:size=10" +font-1 = "Noto Sans CJK JP:size=10" +font-2 = "Font Awesome 5 Free:style=Solid:size=10" +font-3 = "Font Awesome 5 Free:style=Regular:size=10" +font-4 = "Font Awesome 5 Brands:style=Regular:size=10" padding = 2 module-margin = 1 diff --git a/polybar/.config/polybar/launch.sh b/polybar/.config/polybar/launch.sh index 06561f40..6c466a4a 100755 --- a/polybar/.config/polybar/launch.sh +++ b/polybar/.config/polybar/launch.sh @@ -2,6 +2,9 @@ # New Start: A modern Arch workflow built with an emphasis on functionality. # Copyright (C) 2017-2018 Donovan Glover +POLYBAR_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2) +POLYBAR_SCALE=$(($POLYBAR_DPI / 96)) + # Terminate any previous instances of polybar killall -q polybar @@ -12,23 +15,25 @@ bspc_config() { } # If no bar was specified, we're done here. -if [ -z "$1" ]; then bspc_config 0 4 0; exit; fi +if [ -z "$1" ]; then bspc_config 0 $((2 * $POLYBAR_SCALE)) 0; exit; fi # Set defaults -POLYBAR_HEIGHT=80 +POLYBAR_HEIGHT=$((40 * $POLYBAR_SCALE)) HOST_WIDTH=$(bspc query -T -m | jq '.rectangle.width') # 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_BORDER_SIZE=$((2 * $POLYBAR_SCALE)) # Later set to bspwm's border_width + POLYBAR_OFFSET_XY=$((30 * $POLYBAR_SCALE)) # Later set to bspwm's window_gap POLYBAR_WIDTH=$(($HOST_WIDTH - $POLYBAR_OFFSET_XY * 2)) +else + POLYBAR_WIDTH=$HOST_WIDTH 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} +BSPWM_BORDER_WIDTH=${POLYBAR_BORDER_SIZE:-$((4 * $POLYBAR_SCALE))} +BSPWM_WINDOW_GAP=${POLYBAR_OFFSET_XY:-$((20 * $POLYBAR_SCALE))} bspc_config $BSPWM_TOP_PADDING $BSPWM_BORDER_WIDTH $BSPWM_WINDOW_GAP @@ -36,11 +41,12 @@ bspc_config $BSPWM_TOP_PADDING $BSPWM_BORDER_WIDTH $BSPWM_WINDOW_GAP mkdir -p $HOME/.cache/polybar cat >$HOME/.cache/polybar/config <