Polybar Margin & Padding Adjustments

- Make padding & margins consistent for polybar modules
- Add padding to left and right of bar
- Add new environment variable for dwm module padding
This commit is contained in:
Sravan Balaji 2021-12-05 12:10:25 -05:00
parent 9a85c4983a
commit 57c2add016
2 changed files with 64 additions and 44 deletions

View File

@ -5446,8 +5446,9 @@ dunst-notification-status-underline = ${self.green}
#+BEGIN_SRC conf :tangle polybar/config.ini
[sizes]
bar-height = ${xrdb:polybar.bar-height:25}
module-margin = ${xrdb:polybar.module-margin:2}
module-padding = ${xrdb:polybar.module-padding:2}
module-margin = ${xrdb:polybar.module-margin:1}
module-padding = ${xrdb:polybar.module-padding:1}
module-dwm-padding = ${xrdb:polybar.module-dwm-padding:2}
tray-maxsize = ${xrdb:polybar.tray-maxsize:15}
tray-scale = ${xrdb:polybar.tray-scale:1}
maxlen = ${xrdb:polybar.maxlen:50}
@ -5586,6 +5587,7 @@ line-color = #fff
; Number of spaces to add at the beginning/end of the bar
; Individual side values can be defined using:
; padding-{left,right}
padding-left = ${self.module-margin}
padding-right = ${self.module-margin}
; Number of spaces to add before/after each module
@ -5730,7 +5732,7 @@ content = ""
content-foreground = ${colors.powermenu-foreground}
content-background = ${colors.powermenu-background}
content-underline = ${colors.powermenu-underline}
content-padding = ${bar/mybar.module-margin}
content-padding = ${sizes.module-padding}
; "click-(left|middle|right)" will be executed using "/bin/sh -c $COMMAND"
; click-left = notify-send left
@ -5787,7 +5789,7 @@ label-title-foreground = ${colors.dwm-title-foreground}
label-title-background = ${colors.dwm-title-background}
label-title-underline = ${colors.dwm-title-underline}
label-title-maxlen = ${sizes.maxlen}
; label-title-padding = ${sizes.module-padding}
label-title-padding = ${sizes.module-dwm-padding}
; Symbol of current layout
; Available tokens:
@ -5796,14 +5798,14 @@ label-layout = %symbol%
label-layout-foreground = ${colors.dwm-layout-foreground}
label-layout-background = ${colors.dwm-layout-background}
label-layout-underline = ${colors.dwm-layout-underline}
label-layout-padding = ${sizes.module-padding}
label-layout-padding = ${sizes.module-dwm-padding}
; Text to show when currently focused window is floating
label-floating = "(F)"
label-floating-foreground = ${colors.dwm-floating-foreground}
label-floating-background = ${colors.dwm-floating-background}
label-floating-underline = ${colors.dwm-floating-underline}
; label-floating-padding = ${sizes.module-padding}
label-floating-padding = ${sizes.module-dwm-padding}
; States: focused, unfocused, visible, urgent, empty
; Available tokens:
@ -5814,28 +5816,28 @@ label-focused = %name%
label-focused-foreground = ${colors.dwm-focused-foreground}
label-focused-background = ${colors.dwm-focused-background}
label-focused-underline = ${colors.dwm-focused-underline}
label-focused-padding = ${sizes.module-padding}
label-focused-padding = ${sizes.module-dwm-padding}
; unfocused = Unselected tag on unselected monitor
label-unfocused = %name%
label-unfocused-foreground = ${colors.dwm-unfocused-foreground}
label-unfocused-background = ${colors.dwm-unfocused-background}
label-unfocused-underline = ${colors.dwm-unfocused-underline}
label-unfocused-padding = ${sizes.module-padding}
label-unfocused-padding = ${sizes.module-dwm-padding}
; visible = Unselected tag, but occupied tag on any monitor
label-visible = %name%
label-visible-foreground = ${colors.dwm-visible-foreground}
label-visible-background = ${colors.dwm-visible-background}
label-visible-underline = ${colors.dwm-visible-underline}
label-visible-padding = ${sizes.module-padding}
label-visible-padding = ${sizes.module-dwm-padding}
; urgent = Unselected tag with window that has urgency hint set
label-urgent = %name%
label-urgent-foreground = ${colors.dwm-urgent-foreground}
label-urgent-background = ${colors.dwm-urgent-background}
label-urgent-underline = ${colors.dwm-urgent-underline}
label-urgent-padding = ${sizes.module-padding}
label-urgent-padding = ${sizes.module-dwm-padding}
; empty = Unselected and unoccupied tag
; This can be set to an empty string to hide empty tags
@ -5843,7 +5845,7 @@ label-empty = %name%
label-empty-foreground = ${colors.dwm-empty-foreground}
label-empty-background = ${colors.dwm-empty-background}
label-empty-underline = ${colors.dwm-empty-underline}
label-empty-padding = ${sizes.module-padding}
label-empty-padding = ${sizes.module-dwm-padding}
#+END_SRC
**** Media Playing (Playerctl)
@ -5876,9 +5878,9 @@ interval = ${intervals.media-playing}
; <output> - deprecated
; <label> (default)
format = <label>
; format-padding = ${sizes.module-padding}
; format-background = ${colors.background}
; format-foreground =
; format-padding = 4
; Available tokens:
; %output%
@ -5888,6 +5890,7 @@ label-foreground = ${colors.media-playing-foreground}
label-background = ${colors.media-playing-background}
label-underline = ${colors.media-playing-underline}
label-maxlen = ${sizes.maxlen}
label-padding = ${sizes.module-padding}
; Available tokens:
; %counter%
@ -5967,6 +5970,7 @@ label = " %date%"
label-foreground = ${colors.date-foreground}
label-background = ${colors.date-background}
label-underline = ${colors.date-underline}
label-padding = ${sizes.module-padding}
#+END_SRC
**** Time
@ -6004,6 +6008,7 @@ label = " %time%"
label-foreground = ${colors.time-foreground}
label-background = ${colors.time-background}
label-underline = ${colors.time-underline}
label-padding = ${sizes.module-padding}
#+END_SRC
**** Kernel
@ -6037,12 +6042,12 @@ format = <label>
format-foreground = ${colors.kernel-foreground}
format-background = ${colors.kernel-background}
format-underline = ${colors.kernel-underline}
; format-padding = 4
; Available tokens:
; %output%
; Default: %output%
label = %output%
label-padding = ${sizes.module-padding}
; Available tokens:
; %counter%
@ -6080,7 +6085,7 @@ interval = ${intervals.cpu}
; <bar-load>
; <ramp-load>
; <ramp-coreload>
format = %{A1:kitty -e btop &:} <label> %{A}
format = %{A1:kitty -e btop &:}<label>%{A}
; Available tokens:
; %percentage% (default) - total cpu load averaged over all cores
@ -6088,6 +6093,7 @@ format = %{A1:kitty -e btop &:} <label> %{A}
; %percentage-cores% - load percentage for each core
; %percentage-core[1-9]% - load percentage for specific core
label =  %percentage%%
label-padding = ${sizes.module-padding}
label-foreground = ${colors.cpu-foreground}
label-background = ${colors.cpu-background}
label-underline = ${colors.cpu-underline}
@ -6125,7 +6131,7 @@ interval = ${intervals.memory}
; <bar-swap-free>
; <ramp-swap-used>
; <ramp-swap-free>
format = %{A1:kitty -e btop &:} <label> %{A}
format = %{A1:kitty -e btop &:}<label>%{A}
; Available tokens:
; %percentage_used% (default)
@ -6146,6 +6152,7 @@ format = %{A1:kitty -e btop &:} <label> %{A}
; %gb_swap_used%
label =  %percentage_used%%
label-padding = ${sizes.module-padding}
label-foreground = ${colors.memory-foreground}
label-background = ${colors.memory-background}
label-underline = ${colors.memory-underline}
@ -6203,14 +6210,14 @@ fixed-values = true
; Spacing between entries
; Default: 2
spacing = ${bar/mybar.module-margin}
spacing = ${sizes.module-margin}
; Available tags:
; <label-mounted> (default)
; <bar-free>
; <bar-used>
; <ramp-capacity>
format-mounted = %{A1:filelight &:} <label-mounted> %{A}
format-mounted = %{A1:filelight &:}<label-mounted>%{A}
; Available tags:
; <label-unmounted> (default)
@ -6230,6 +6237,7 @@ label-mounted =  %percentage_used%%
label-mounted-foreground = ${colors.filesystem-foreground}
label-mounted-background = ${colors.filesystem-background}
label-mounted-underline = ${colors.filesystem-underline}
label-mounted-padding = ${sizes.module-padding}
; Available tokens:
; %mountpoint%
@ -6238,6 +6246,7 @@ label-unmounted = %mountpoint% is not mounted
label-unmounted-foreground = ${colors.filesystem-foreground}
label-unmounted-background = ${colors.filesystem-background}
label-unmounted-underline = ${colors.filesystem-underline}
label-unmounted-padding = ${sizes.module-padding}
#+END_SRC
**** Dunst Notification Status
@ -6281,6 +6290,7 @@ label = %output%
label-foreground = ${colors.dunst-notification-status-foreground}
label-background = ${colors.dunst-notification-status-background}
label-underline = ${colors.dunst-notification-status-underline}
label-padding = ${sizes.module-padding}
; label-maxlen =
; Available tokens:

View File

@ -95,8 +95,9 @@ dunst-notification-status-underline = ${self.green}
[sizes]
bar-height = ${xrdb:polybar.bar-height:25}
module-margin = ${xrdb:polybar.module-margin:2}
module-padding = ${xrdb:polybar.module-padding:2}
module-margin = ${xrdb:polybar.module-margin:1}
module-padding = ${xrdb:polybar.module-padding:1}
module-dwm-padding = ${xrdb:polybar.module-dwm-padding:2}
tray-maxsize = ${xrdb:polybar.tray-maxsize:15}
tray-scale = ${xrdb:polybar.tray-scale:1}
maxlen = ${xrdb:polybar.maxlen:50}
@ -216,6 +217,7 @@ line-color = #fff
; Number of spaces to add at the beginning/end of the bar
; Individual side values can be defined using:
; padding-{left,right}
padding-left = ${self.module-margin}
padding-right = ${self.module-margin}
; Number of spaces to add before/after each module
@ -354,7 +356,7 @@ content = ""
content-foreground = ${colors.powermenu-foreground}
content-background = ${colors.powermenu-background}
content-underline = ${colors.powermenu-underline}
content-padding = ${bar/mybar.module-margin}
content-padding = ${sizes.module-padding}
; "click-(left|middle|right)" will be executed using "/bin/sh -c $COMMAND"
; click-left = notify-send left
@ -407,7 +409,7 @@ label-title-foreground = ${colors.dwm-title-foreground}
label-title-background = ${colors.dwm-title-background}
label-title-underline = ${colors.dwm-title-underline}
label-title-maxlen = ${sizes.maxlen}
; label-title-padding = ${sizes.module-padding}
label-title-padding = ${sizes.module-dwm-padding}
; Symbol of current layout
; Available tokens:
@ -416,14 +418,14 @@ label-layout = %symbol%
label-layout-foreground = ${colors.dwm-layout-foreground}
label-layout-background = ${colors.dwm-layout-background}
label-layout-underline = ${colors.dwm-layout-underline}
label-layout-padding = ${sizes.module-padding}
label-layout-padding = ${sizes.module-dwm-padding}
; Text to show when currently focused window is floating
label-floating = "(F)"
label-floating-foreground = ${colors.dwm-floating-foreground}
label-floating-background = ${colors.dwm-floating-background}
label-floating-underline = ${colors.dwm-floating-underline}
; label-floating-padding = ${sizes.module-padding}
label-floating-padding = ${sizes.module-dwm-padding}
; States: focused, unfocused, visible, urgent, empty
; Available tokens:
@ -434,28 +436,28 @@ label-focused = %name%
label-focused-foreground = ${colors.dwm-focused-foreground}
label-focused-background = ${colors.dwm-focused-background}
label-focused-underline = ${colors.dwm-focused-underline}
label-focused-padding = ${sizes.module-padding}
label-focused-padding = ${sizes.module-dwm-padding}
; unfocused = Unselected tag on unselected monitor
label-unfocused = %name%
label-unfocused-foreground = ${colors.dwm-unfocused-foreground}
label-unfocused-background = ${colors.dwm-unfocused-background}
label-unfocused-underline = ${colors.dwm-unfocused-underline}
label-unfocused-padding = ${sizes.module-padding}
label-unfocused-padding = ${sizes.module-dwm-padding}
; visible = Unselected tag, but occupied tag on any monitor
label-visible = %name%
label-visible-foreground = ${colors.dwm-visible-foreground}
label-visible-background = ${colors.dwm-visible-background}
label-visible-underline = ${colors.dwm-visible-underline}
label-visible-padding = ${sizes.module-padding}
label-visible-padding = ${sizes.module-dwm-padding}
; urgent = Unselected tag with window that has urgency hint set
label-urgent = %name%
label-urgent-foreground = ${colors.dwm-urgent-foreground}
label-urgent-background = ${colors.dwm-urgent-background}
label-urgent-underline = ${colors.dwm-urgent-underline}
label-urgent-padding = ${sizes.module-padding}
label-urgent-padding = ${sizes.module-dwm-padding}
; empty = Unselected and unoccupied tag
; This can be set to an empty string to hide empty tags
@ -463,7 +465,7 @@ label-empty = %name%
label-empty-foreground = ${colors.dwm-empty-foreground}
label-empty-background = ${colors.dwm-empty-background}
label-empty-underline = ${colors.dwm-empty-underline}
label-empty-padding = ${sizes.module-padding}
label-empty-padding = ${sizes.module-dwm-padding}
[module/media-playing]
type = custom/script
@ -490,9 +492,9 @@ interval = ${intervals.media-playing}
; <output> - deprecated
; <label> (default)
format = <label>
; format-padding = ${sizes.module-padding}
; format-background = ${colors.background}
; format-foreground =
; format-padding = 4
; Available tokens:
; %output%
@ -502,6 +504,7 @@ label-foreground = ${colors.media-playing-foreground}
label-background = ${colors.media-playing-background}
label-underline = ${colors.media-playing-underline}
label-maxlen = ${sizes.maxlen}
label-padding = ${sizes.module-padding}
; Available tokens:
; %counter%
@ -555,6 +558,7 @@ label = " %date%"
label-foreground = ${colors.date-foreground}
label-background = ${colors.date-background}
label-underline = ${colors.date-underline}
label-padding = ${sizes.module-padding}
[module/time]
type = internal/date
@ -588,6 +592,7 @@ label = " %time%"
label-foreground = ${colors.time-foreground}
label-background = ${colors.time-background}
label-underline = ${colors.time-underline}
label-padding = ${sizes.module-padding}
[module/kernel]
type = custom/script
@ -617,12 +622,12 @@ format = <label>
format-foreground = ${colors.kernel-foreground}
format-background = ${colors.kernel-background}
format-underline = ${colors.kernel-underline}
; format-padding = 4
; Available tokens:
; %output%
; Default: %output%
label = %output%
label-padding = ${sizes.module-padding}
; Available tokens:
; %counter%
@ -656,7 +661,7 @@ interval = ${intervals.cpu}
; <bar-load>
; <ramp-load>
; <ramp-coreload>
format = %{A1:kitty -e btop &:} <label> %{A}
format = %{A1:kitty -e btop &:}<label>%{A}
; Available tokens:
; %percentage% (default) - total cpu load averaged over all cores
@ -664,6 +669,7 @@ format = %{A1:kitty -e btop &:} <label> %{A}
; %percentage-cores% - load percentage for each core
; %percentage-core[1-9]% - load percentage for specific core
label =  %percentage%%
label-padding = ${sizes.module-padding}
label-foreground = ${colors.cpu-foreground}
label-background = ${colors.cpu-background}
label-underline = ${colors.cpu-underline}
@ -697,7 +703,7 @@ interval = ${intervals.memory}
; <bar-swap-free>
; <ramp-swap-used>
; <ramp-swap-free>
format = %{A1:kitty -e btop &:} <label> %{A}
format = %{A1:kitty -e btop &:}<label>%{A}
; Available tokens:
; %percentage_used% (default)
@ -718,6 +724,7 @@ format = %{A1:kitty -e btop &:} <label> %{A}
; %gb_swap_used%
label =  %percentage_used%%
label-padding = ${sizes.module-padding}
label-foreground = ${colors.memory-foreground}
label-background = ${colors.memory-background}
label-underline = ${colors.memory-underline}
@ -771,14 +778,14 @@ fixed-values = true
; Spacing between entries
; Default: 2
spacing = ${bar/mybar.module-margin}
spacing = ${sizes.module-margin}
; Available tags:
; <label-mounted> (default)
; <bar-free>
; <bar-used>
; <ramp-capacity>
format-mounted = %{A1:filelight &:} <label-mounted> %{A}
format-mounted = %{A1:filelight &:}<label-mounted>%{A}
; Available tags:
; <label-unmounted> (default)
@ -798,6 +805,7 @@ label-mounted =  %percentage_used%%
label-mounted-foreground = ${colors.filesystem-foreground}
label-mounted-background = ${colors.filesystem-background}
label-mounted-underline = ${colors.filesystem-underline}
label-mounted-padding = ${sizes.module-padding}
; Available tokens:
; %mountpoint%
@ -806,6 +814,7 @@ label-unmounted = %mountpoint% is not mounted
label-unmounted-foreground = ${colors.filesystem-foreground}
label-unmounted-background = ${colors.filesystem-background}
label-unmounted-underline = ${colors.filesystem-underline}
label-unmounted-padding = ${sizes.module-padding}
[module/dunst-notification-status]
type = custom/script
@ -843,6 +852,7 @@ label = %output%
label-foreground = ${colors.dunst-notification-status-foreground}
label-background = ${colors.dunst-notification-status-background}
label-underline = ${colors.dunst-notification-status-underline}
label-padding = ${sizes.module-padding}
; label-maxlen =
; Available tokens: