Further polybar refactoring thanks to variables

master
Quentin Duchemin 2019-11-14 19:06:44 +01:00
parent 76ab54f7a0
commit 437dea9d57
Signed by: Chosto
GPG Key ID: 0547178FEEDE7D6B
5 changed files with 116 additions and 120 deletions

View File

@ -9,6 +9,44 @@ accent = #fba922
[global/wm] [global/wm]
margin-top=50 margin-top=50
; Common to top and bottom bars
[bar/common]
width = 100%
dpi = ${variables.dpi}
enable-ipc = true
height = ${variables.height}
foreground = ${colors.foreground}
background = ${colors.background}
line-size = 3
line-color = #f00
locale = fr_FR.UTF-8
monitor = ${env:MONITOR:HDMI-0}
[bar/chostytopbar]
inherit = bar/common
font-0 = NotoSans-Regular:size=10;2
font-1 = MaterialIcons-Regular:size=11;4
font-2 = Symbola:size=10;2
font-3 = Weather Icons:size=10;3
overline-size = 10
underline-size = 10
overline-color = ${self.background}
underline-color = ${self.background}
border-bottom-size = 1
border-bottom-color = #333
padding-left = 2
padding-right = 10
module-margin-left = 4
module-margin-right = 4
modules-left = ${variables.top_left}
modules-center = ${variables.top_center}
modules-right = ${variables.top_right}
tray-position = right
[bar/chostybottombar] [bar/chostybottombar]
inherit = bar/common inherit = bar/common
bottom = true bottom = true
@ -41,7 +79,7 @@ label-maxlen=100
[module/wireless-network] [module/wireless-network]
type = internal/network type = internal/network
interface = wlp8s0 interface = ${variables.wireless_interface}
interval = 1 interval = 1
label-connected = %{F#ddd}%essid%  %local_ip% %{F#77dd77}%{F-}%downspeed% %{F#dd7777}%{F-}%upspeed% label-connected = %{F#ddd}%essid%  %local_ip% %{F#77dd77}%{F-}%downspeed% %{F#dd7777}%{F-}%upspeed%
label-disconnected = Ethernet disconnected label-disconnected = Ethernet disconnected
@ -222,58 +260,21 @@ interval = 60
type = custom/script type = custom/script
exec = ~/.config/polybar/scripts/system-uptime-pretty.sh exec = ~/.config/polybar/scripts/system-uptime-pretty.sh
interval = 30 interval = 30
; Common to top and bottom bars [variables]
[bar/common] dpi = 150
width = 100% height = 54
enable-ipc = true wireless_interface = wlp2s0
height = 27 top_left = powermenu system-uptime-pretty battery
foreground = ${colors.foreground} top_center = xwindow
background = ${colors.background} top_right = system-usb-udev pulseaudio date
line-size = 3
line-color = #f00
locale = fr_FR.UTF-8 [module/pulseaudio]
monitor = ${env:MONITOR:HDMI-0} type = internal/pulseaudio
interval = 5
[bar/chostytopbar]
inherit = bar/common
font-0 = NotoSans-Regular:size=10;2
font-1 = MaterialIcons-Regular:size=11;4
font-2 = Symbola:size=10;2
font-3 = Weather Icons:size=10;3
overline-size = 10
underline-size = 10
overline-color = ${self.background}
underline-color = ${self.background}
border-bottom-size = 1
border-bottom-color = #333
padding-left = 2
padding-right = 10
module-margin-left = 4
module-margin-right = 4
modules-left = powermenu system-uptime-pretty
modules-center = xwindow
modules-right = system-usb-udev volume date
tray-position = right
[module/volume]
type = internal/volume
master-soundcard = hw:PCH
speaker-soundcard = hw:PCH
headphone-soundcard = hw:PCH
master-mixer = Master
speaker-mixer = Front
mapped = true
format-volume = <ramp-volume> <label-volume> format-volume = <ramp-volume> <label-volume>
label-muted = 🔇 muted label-muted = 🔇 muted
label-muted-foreground = #66 label-muted-foreground = #666
ramp-volume-0 = 🔈 ramp-volume-0 = 🔈
ramp-volume-1 = 🔉 ramp-volume-1 = 🔉
@ -281,3 +282,16 @@ ramp-volume-2 = 🔊
ramp-headphones-0 =  ramp-headphones-0 = 
ramp-headphones-1 =  ramp-headphones-1 = 
[module/battery]
type = internal/battery
full-at = 100
battery = BAT0
adapter = AC0
poll-interval = 5
format-charging = <label-charging>
format-discharging = <label-discharging>
format-full = <label-full>
label-charging =  %percentage%%
label-discharging =  %percentage%%
label-full = %{F#77dd77}

View File

@ -1,39 +1,10 @@
; Common to top and bottom bars [variables]
[bar/common] dpi = 100
width = 100%
enable-ipc = true
height = 27 height = 27
foreground = ${colors.foreground} wireless_interface = wlp8s0
background = ${colors.background} top_left = powermenu system-uptime-pretty
line-size = 3 top_center = xwindow
line-color = #f00 top_right = system-usb-udev volume date
locale = fr_FR.UTF-8
monitor = ${env:MONITOR:HDMI-0}
[bar/chostytopbar]
inherit = bar/common
font-0 = NotoSans-Regular:size=10;2
font-1 = MaterialIcons-Regular:size=11;4
font-2 = Symbola:size=10;2
font-3 = Weather Icons:size=10;3
overline-size = 10
underline-size = 10
overline-color = ${self.background}
underline-color = ${self.background}
border-bottom-size = 1
border-bottom-color = #333
padding-left = 2
padding-right = 10
module-margin-left = 4
module-margin-right = 4
modules-left = powermenu system-uptime-pretty
modules-center = xwindow
modules-right = system-usb-udev volume date
tray-position = right
[module/volume] [module/volume]
type = internal/volume type = internal/volume

View File

@ -1,40 +1,10 @@
; Common to top and bottom bars [variables]
[bar/common]
dpi = 150 dpi = 150
width = 100%
enable-ipc = true
height = 54 height = 54
foreground = ${colors.foreground} wireless_interface = wlp2s0
background = ${colors.background} top_left = powermenu system-uptime-pretty battery
line-size = 3 top_center = xwindow
line-color = #f00 top_right = system-usb-udev pulseaudio date
locale = fr_FR.UTF-8
monitor = ${env:MONITOR:HDMI-0}
[bar/chostytopbar]
inherit = bar/common
font-0 = NotoSans-Regular:size=10;2
font-1 = MaterialIcons-Regular:size=11;4
font-2 = Symbola:size=11;2
font-3 = Weather Icons:size=10;3
overline-size = 10
underline-size = 10
overline-color = ${self.background}
underline-color = ${self.background}
border-bottom-size = 1
border-bottom-color = #333
padding-left = 2
padding-right = 10
module-margin-left = 4
module-margin-right = 4
modules-left = powermenu system-uptime-pretty battery
modules-center = xwindow
modules-right = system-usb-udev pulseaudio date
tray-position = right
[module/pulseaudio] [module/pulseaudio]
type = internal/pulseaudio type = internal/pulseaudio

View File

@ -9,6 +9,44 @@ accent = #fba922
[global/wm] [global/wm]
margin-top=50 margin-top=50
; Common to top and bottom bars
[bar/common]
width = 100%
dpi = ${variables.dpi}
enable-ipc = true
height = ${variables.height}
foreground = ${colors.foreground}
background = ${colors.background}
line-size = 3
line-color = #f00
locale = fr_FR.UTF-8
monitor = ${env:MONITOR:HDMI-0}
[bar/chostytopbar]
inherit = bar/common
font-0 = NotoSans-Regular:size=10;2
font-1 = MaterialIcons-Regular:size=11;4
font-2 = Symbola:size=10;2
font-3 = Weather Icons:size=10;3
overline-size = 10
underline-size = 10
overline-color = ${self.background}
underline-color = ${self.background}
border-bottom-size = 1
border-bottom-color = #333
padding-left = 2
padding-right = 10
module-margin-left = 4
module-margin-right = 4
modules-left = ${variables.top_left}
modules-center = ${variables.top_center}
modules-right = ${variables.top_right}
tray-position = right
[bar/chostybottombar] [bar/chostybottombar]
inherit = bar/common inherit = bar/common
bottom = true bottom = true
@ -41,7 +79,7 @@ label-maxlen=100
[module/wireless-network] [module/wireless-network]
type = internal/network type = internal/network
interface = wlp8s0 interface = ${variables.wireless_interface}
interval = 1 interval = 1
label-connected = %{F#ddd}%essid%  %local_ip% %{F#77dd77}%{F-}%downspeed% %{F#dd7777}%{F-}%upspeed% label-connected = %{F#ddd}%essid%  %local_ip% %{F#77dd77}%{F-}%downspeed% %{F#dd7777}%{F-}%upspeed%
label-disconnected = Ethernet disconnected label-disconnected = Ethernet disconnected

View File

@ -78,3 +78,6 @@ for m in $merge_config; do
cat "${f}" >> ${CONFIG}/${m}/config cat "${f}" >> ${CONFIG}/${m}/config
done done
done done
# Reload i3 configuration
i3-msg reload && echo "Successfully reloaded i3 config"