From f1b4f8255686e5956223e838954c95526c48d3af Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 5 Dec 2018 11:20:10 -0500 Subject: [PATCH 1/8] polybar: Remove the no bar option It turns out that polybar is able to provide very useful information for window management in bspwm, so much so that disabling the bar completely wouldn't make sense. Since there's already a way to hide the bar (with a sxhkd keybind), and since a "no bar" option would break this functionality even though the hidden bar keybind produces the same result, it makes sense to remove this. --- polybar/.config/polybar/launch.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/polybar/.config/polybar/launch.sh b/polybar/.config/polybar/launch.sh index cc170069..bea8a153 100755 --- a/polybar/.config/polybar/launch.sh +++ b/polybar/.config/polybar/launch.sh @@ -14,9 +14,6 @@ bspc_config() { bspc config window_gap $3 & } -# If no bar was specified, we're done here. -if [ -z "$1" ]; then bspc_config 0 $((1 * $POLYBAR_SCALE)) 0; exit; fi - # Set defaults POLYBAR_HEIGHT=$((40 * $POLYBAR_SCALE)) HOST_WIDTH=$(bspc query -T -m | jq '.rectangle.width') From 8b12687dd8de918ef8ff2f38dfa18b33ef65a80f Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 5 Dec 2018 11:26:27 -0500 Subject: [PATCH 2/8] polybar: Remove border width and window gap by default Realistically, you use a window manager to take up all the available space on a screen. Borders and gaps are counter-intuitive in this regard. Since polybar has a module that shows the title of the focused window, using a border width even in gapless mode is no longer necessary. This also works conveniently well with bspwm's monocle desktop layout, which will also inherit the no-border no-gaps methodology and take up all the available screen space. --- polybar/.config/polybar/launch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polybar/.config/polybar/launch.sh b/polybar/.config/polybar/launch.sh index bea8a153..9ecb067f 100755 --- a/polybar/.config/polybar/launch.sh +++ b/polybar/.config/polybar/launch.sh @@ -29,8 +29,8 @@ 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:-$((1 * $POLYBAR_SCALE))} -BSPWM_WINDOW_GAP=${POLYBAR_OFFSET_XY:-$((20 * $POLYBAR_SCALE))} +BSPWM_BORDER_WIDTH=${POLYBAR_BORDER_SIZE:-0} +BSPWM_WINDOW_GAP=${POLYBAR_OFFSET_XY:-0} bspc_config $BSPWM_TOP_PADDING $BSPWM_BORDER_WIDTH $BSPWM_WINDOW_GAP From 1e8652d638b8a541b898a8161c53445280e7000a Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 5 Dec 2018 14:51:07 -0500 Subject: [PATCH 3/8] polybar: Remove ws-icons This can be handled by bspwm instead. --- polybar/.config/polybar/config | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index d67b643d..f74a3789 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -64,17 +64,6 @@ label-urgent-foreground = ${color.yellow} label-occupied-foreground = ${color.background-alt} label-empty-foreground = ${color.green} -ws-icon-0 = 1;一 -ws-icon-1 = 2;二 -ws-icon-2 = 3;三 -ws-icon-3 = 4;四 -ws-icon-4 = 5;五 -ws-icon-5 = 6;六 -ws-icon-6 = 7;七 -ws-icon-7 = 8;八 -ws-icon-8 = 9;九 -ws-icon-9 = 10;十 - [module/cpu] type = internal/cpu label =  %percentage%% From 2439706a286dca40a52ead3f8fa26db2fc40ee6a Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 5 Dec 2018 15:29:19 -0500 Subject: [PATCH 4/8] polybar: Show title of focused window at center It turns out that showing the window title is very useful for actually using the window manager, especially with no visual indicator through window borders to determine which one is selected. --- polybar/.config/polybar/config | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index f74a3789..d2dccd05 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -14,7 +14,7 @@ background-alt = ${xrdb:color8} [bar/main] modules-left = bspwm -modules-center = mpd +modules-center = window modules-right = cpu ram volume date time monitor = VGA-1 @@ -109,4 +109,9 @@ type = internal/alsa label-volume =  %percentage%% format-volume-foreground = ${color.background-alt} +[module/window] +type = internal/xwindow +label-maxlen = 120 +label-empty = /usr/bin/bspwm + ; vim:ft=dosini From b14e9711654dab0e7bb52c3b3681b95d4f16438f Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 5 Dec 2018 15:37:37 -0500 Subject: [PATCH 5/8] polybar: Decrease bspwm label padding --- polybar/.config/polybar/config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index d2dccd05..faec7fa1 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -54,10 +54,10 @@ label-locked-foreground = ${color.background-alt} label-private-foreground = ${color.background-alt} label-sticky-foreground = ${color.background-alt} -label-focused-padding = 2 -label-urgent-padding = 2 -label-occupied-padding = 2 -label-empty-padding = 2 +label-focused-padding = 1 +label-urgent-padding = 1 +label-occupied-padding = 1 +label-empty-padding = 1 label-focused-foreground = ${color.text} label-urgent-foreground = ${color.yellow} From 62619de3729c2daac23d94d94b3cc9abc6088fef Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 5 Dec 2018 17:29:31 -0500 Subject: [PATCH 6/8] polybar: Don't distinguish between empty desktops Time will tell whether or not I keep this, but one less color makes it easier to seamlessly integrate the bar with different color schemes. With this change, the interface is also arguably cleaner. --- polybar/.config/polybar/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index faec7fa1..3f8a3d66 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -62,7 +62,7 @@ label-empty-padding = 1 label-focused-foreground = ${color.text} label-urgent-foreground = ${color.yellow} label-occupied-foreground = ${color.background-alt} -label-empty-foreground = ${color.green} +label-empty-foreground = ${color.background-alt} [module/cpu] type = internal/cpu From 72152ad7f60e8e94d1827a6152b9dbed479c3648 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 5 Dec 2018 17:35:42 -0500 Subject: [PATCH 7/8] polybar: Set foreground to background-alt by default Since basically everything uses background-alt, it's easier to make each module inherit this property instead. --- polybar/.config/polybar/config | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index 3f8a3d66..71b13aa9 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -21,7 +21,7 @@ monitor = VGA-1 wm-restack = bspwm include-file = $HOME/.cache/polybar/config -foreground = ${color.text} +foreground = ${color.background-alt} background = ${color.background} border-color = ${color.text} @@ -50,9 +50,6 @@ label-private-padding = 1 label-sticky-padding = 1 label-monocle-foreground = ${color.yellow} -label-locked-foreground = ${color.background-alt} -label-private-foreground = ${color.background-alt} -label-sticky-foreground = ${color.background-alt} label-focused-padding = 1 label-urgent-padding = 1 @@ -61,30 +58,24 @@ label-empty-padding = 1 label-focused-foreground = ${color.text} label-urgent-foreground = ${color.yellow} -label-occupied-foreground = ${color.background-alt} -label-empty-foreground = ${color.background-alt} [module/cpu] type = internal/cpu label =  %percentage%% -format-foreground = ${color.background-alt} [module/ram] type = internal/memory label =  %gb_used% -format-foreground = ${color.background-alt} [module/date] type = internal/date date =  %d.%m.%y #date =  %B %d, %Y #date =  %A -format-foreground = ${color.background-alt} [module/time] type = internal/date date =  %H:%M -format-foreground = ${color.background-alt} [module/battery] type = internal/battery @@ -101,13 +92,10 @@ format-offline = No song is currently playing. label-song-maxlen = 100 label-song-ellipsis = true format-online =  -format-offline-foreground = ${color.background-alt} -format-online-foreground = ${color.background-alt} [module/volume] type = internal/alsa label-volume =  %percentage%% -format-volume-foreground = ${color.background-alt} [module/window] type = internal/xwindow From 454848572a9f9ae0752461f3cb36c632d332c0ce Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 5 Dec 2018 18:03:27 -0500 Subject: [PATCH 8/8] polybar: Fix padding It turns out that the left padding from the bspwm labels are used in addition to the left padding from polybar, so in order for padding to be consistent across both the left and right sections, the section with the bspwm module needs to have its padding subtracted by the amount used by the bspwm labels. --- polybar/.config/polybar/config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index 71b13aa9..c6a1c5c2 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -31,7 +31,8 @@ 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 +padding-left = 1 +padding-right = 2 module-margin = 1 [module/bspwm]