Add polybar config file merging tool

master
Quentin Duchemin 2019-11-14 16:09:40 +01:00
parent b00bd3ebff
commit ad9b1ea45a
Signed by: Chosto
GPG Key ID: 0547178FEEDE7D6B
6 changed files with 201 additions and 221 deletions

View File

@ -37,7 +37,7 @@ smart_gaps on
exec --no-startup-id compton exec --no-startup-id compton
#start polybar #start polybar
exec --no-startup-id $HOME/.config/polybar/scripts/launch_polybar.sh exec_always --no-startup-id $HOME/.config/polybar/scripts/launch_polybar.sh
# configure keyboard layout # configure keyboard layout
exec setxkbmap fr exec setxkbmap fr

View File

@ -1,12 +1,3 @@
;=====================================================
;
; To learn more about how to configure Polybar
; go to https://github.com/jaagr/polybar
;
; The README contains alot of information
;
;=====================================================
[colors] [colors]
background = #bb2f343f background = #bb2f343f
foreground = #eee foreground = #eee
@ -18,43 +9,6 @@ accent = #fba922
[global/wm] [global/wm]
margin-top=50 margin-top=50
; Common to top and bottom bars
[bar/common]
width = 100%
enable-ipc = true
height = 27
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 = powermenu system-uptime-pretty
modules-center = xwindow
modules-right = system-usb-udev volume date
tray-position = right
[bar/chostybottombar] [bar/chostybottombar]
inherit = bar/common inherit = bar/common
bottom = true bottom = true
@ -77,31 +31,8 @@ font-3 = MaterialIcons-Regular:size=11;4
font-4 = Font Awesome 5 Free:style=solid:size=10;2 font-4 = Font Awesome 5 Free:style=solid:size=10;2
modules-left = i3 modules-left = i3
;modules-center = ;modules-center =
modules-right = wireless-network wired-network updates-arch-combined temperature cpu memory filesystem-custom modules-right = wireless-network updates-arch-combined temperature cpu memory filesystem-custom
[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>
label-muted = 🔇 muted
label-muted-foreground = #66
ramp-volume-0 = 🔈
ramp-volume-1 = 🔉
ramp-volume-2 = 🔊
ramp-headphones-0 = 
ramp-headphones-1 = 
[module/xwindow] [module/xwindow]
type = internal/xwindow type = internal/xwindow
@ -154,36 +85,6 @@ label-visible-foreground = #55ffffff
label-visible-font = 0 label-visible-font = 0
label-visible-padding = 4 label-visible-padding = 4
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-underline = ${colors.secondary}
label-layout = %layout%
label-layout-underline = ${colors.secondary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-background = ${colors.secondary}
label-indicator-underline = ${colors.secondary}
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
mount-1 = /mnt/data
mount-2 = /mnt/backup
label-mounted = %{F#0a81f5}%mountpoint%%{F-} · %percentage_used%% ·%{F#555} %free% free
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground-alt}
spacing = 4
[module/cpu] [module/cpu]
type = internal/cpu type = internal/cpu
interval = 0.5 interval = 0.5
@ -230,7 +131,7 @@ bar-used-foreground-0 = #55aa55
bar-used-foreground-1 = #557755 bar-used-foreground-1 = #557755
bar-used-foreground-2 = #f5a70a bar-used-foreground-2 = #f5a70a
bar-used-foreground-3 = #ff5555 bar-used-foreground-3 = #ff5555
bar-used-indicator = bar-used-indicator =
bar-used-indicator-font = 2 bar-used-indicator-font = 2
bar-used-indicator-foreground = #fff bar-used-indicator-foreground = #fff
bar-used-fill =▐ bar-used-fill =▐
@ -262,9 +163,9 @@ label = %{F#77dd77} %{F-} %temperature-c%
label-warn = %{F#dd7777} %{F-} %temperature-c% label-warn = %{F#dd7777} %{F-} %temperature-c%
label-warn-foreground = #dd7777 label-warn-foreground = #dd7777
ramp-0 = ramp-0 =
ramp-1 = ramp-1 =
ramp-2 = ramp-2 =
ramp-foreground = ${colors.foreground-alt} ramp-foreground = ${colors.foreground-alt}
[module/powermenu] [module/powermenu]
@ -300,7 +201,6 @@ menu-2-1 = Power off
menu-2-1-foreground = ${colors.accent} menu-2-1-foreground = ${colors.accent}
menu-2-1-exec = systemctl poweroff menu-2-1-exec = systemctl poweroff
[module/system-usb-udev] [module/system-usb-udev]
type = custom/script type = custom/script
exec = ~/.config/polybar/scripts/system-usb-udev.sh exec = ~/.config/polybar/scripts/system-usb-udev.sh
@ -322,3 +222,62 @@ 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
[bar/common]
width = 100%
enable-ipc = true
height = 27
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 = 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>
label-muted = 🔇 muted
label-muted-foreground = #66
ramp-volume-0 = 🔈
ramp-volume-1 = 🔉
ramp-volume-2 = 🔊
ramp-headphones-0 = 
ramp-headphones-1 = 

View File

@ -0,0 +1,59 @@
; Common to top and bottom bars
[bar/common]
width = 100%
enable-ipc = true
height = 27
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 = 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>
label-muted = 🔇 muted
label-muted-foreground = #66
ramp-volume-0 = 🔈
ramp-volume-1 = 🔉
ramp-volume-2 = 🔊
ramp-headphones-0 = 
ramp-headphones-1 = 

View File

@ -0,0 +1,65 @@
; Common to top and bottom bars
[bar/common]
dpi = 150
width = 100%
enable-ipc = true
height = 54
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=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]
type = internal/pulseaudio
interval = 5
format-volume = <ramp-volume> <label-volume>
label-muted = 🔇 muted
label-muted-foreground = #666
ramp-volume-0 = 🔈
ramp-volume-1 = 🔉
ramp-volume-2 = 🔊
ramp-headphones-0 = 
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,12 +1,3 @@
;=====================================================
;
; To learn more about how to configure Polybar
; go to https://github.com/jaagr/polybar
;
; The README contains alot of information
;
;=====================================================
[colors] [colors]
background = #bb2f343f background = #bb2f343f
foreground = #eee foreground = #eee
@ -18,44 +9,6 @@ accent = #fba922
[global/wm] [global/wm]
margin-top=50 margin-top=50
; Common to top and bottom bars
[bar/common]
dpi = 150
width = 100%
enable-ipc = true
height = 54
foreground = ${colors.foreground}
background = ${colors.background}
line-size = 3
line-color = #f00
locale = en_US.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
[bar/chostybottombar] [bar/chostybottombar]
inherit = bar/common inherit = bar/common
bottom = true bottom = true
@ -79,35 +32,7 @@ font-4 = Font Awesome 5 Free:style=solid:size=10;2
modules-left = i3 modules-left = i3
;modules-center = ;modules-center =
modules-right = wireless-network wired-network updates-arch-combined temperature cpu memory filesystem-custom modules-right = wireless-network updates-arch-combined temperature cpu memory filesystem-custom
[module/pulseaudio]
type = internal/pulseaudio
interval = 5
format-volume = <ramp-volume> <label-volume>
label-muted = 🔇 muted
label-muted-foreground = #666
ramp-volume-0 = 🔈
ramp-volume-1 = 🔉
ramp-volume-2 = 🔊
ramp-headphones-0 = 
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}
[module/xwindow] [module/xwindow]
type = internal/xwindow type = internal/xwindow
@ -116,7 +41,7 @@ label-maxlen=100
[module/wireless-network] [module/wireless-network]
type = internal/network type = internal/network
interface = wlp2s0 interface = wlp8s0
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
@ -135,7 +60,7 @@ ws-icon-3 = 4;
ws-icon-4 = 5; ws-icon-4 = 5;
label-dimmed-underline = ${root.background} label-dimmed-underline = ${root.background}
label-separator = |
label-focused = %icon% %name% label-focused = %icon% %name%
label-focused-foreground = #f3f3f3 label-focused-foreground = #f3f3f3
;label-focused-underline = #${colors.accent} ;label-focused-underline = #${colors.accent}
@ -160,36 +85,6 @@ label-visible-foreground = #55ffffff
label-visible-font = 0 label-visible-font = 0
label-visible-padding = 4 label-visible-padding = 4
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-underline = ${colors.secondary}
label-layout = %layout%
label-layout-underline = ${colors.secondary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-background = ${colors.secondary}
label-indicator-underline = ${colors.secondary}
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
mount-1 = /mnt/data
mount-2 = /mnt/backup
label-mounted = %{F#0a81f5}%mountpoint%%{F-} · %percentage_used%% ·%{F#555} %free% free
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground-alt}
spacing = 4
[module/cpu] [module/cpu]
type = internal/cpu type = internal/cpu
interval = 0.5 interval = 0.5
@ -306,7 +201,6 @@ menu-2-1 = Power off
menu-2-1-foreground = ${colors.accent} menu-2-1-foreground = ${colors.accent}
menu-2-1-exec = systemctl poweroff menu-2-1-exec = systemctl poweroff
[module/system-usb-udev] [module/system-usb-udev]
type = custom/script type = custom/script
exec = ~/.config/polybar/scripts/system-usb-udev.sh exec = ~/.config/polybar/scripts/system-usb-udev.sh

View File

@ -69,9 +69,12 @@ for f in `find ${CONFIG} -type f -name ${DEST_FILENAME}`; do
done done
done done
echo -e "\n=== Generate i3 config file ===" merge_config="polybar i3"
cp ${CONFIG}/i3/config_common ${CONFIG}/i3/config for m in $merge_config; do
for f in `find ${CONFIG}/i3/config.d -type f -name "${1}"`; do echo -e "\n=== Generate ${m} config file ==="
echo "Found ${f}, add to regular config file" cp ${CONFIG}/${m}/config_common ${CONFIG}/${m}/config
cat "${f}" >> ${CONFIG}/i3/config for f in `find ${CONFIG}/${m}/config.d -type f -name "${1}"`; do
echo "Found ${f}, add to regular config file"
cat "${f}" >> ${CONFIG}/${m}/config
done
done done