mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-01 13:54:22 +02:00
polybar: handle alone/primary/secondary configurations
This commit is contained in:
parent
3909defef4
commit
a3ffbddf82
2 changed files with 26 additions and 10 deletions
20
bin/polybar
20
bin/polybar
|
@ -5,10 +5,18 @@ export WLAN=$(nmcli -t device | awk -F: '($2 == "wifi") {print $1; exit}')
|
|||
export DPI=$(xrdb -query | sed -nE 's/^Xft\.dpi:\s*//p')
|
||||
export HEIGHT=$((20 * DPI / 96))
|
||||
|
||||
MONITOR=$(polybar --list-monitors | awk -F: '($0 ~ /primary/) {print $1; exit}') \
|
||||
polybar --reload primary &
|
||||
for MONITOR in $(polybar --list-monitors | awk -F: '($0 !~ /primary/) {print $1}'); do
|
||||
export MONITOR
|
||||
polybar --reload secondary &
|
||||
done
|
||||
NUMS=$(polybar --list-monitors | wc -l)
|
||||
PRIMARY=$(polybar --list-monitors | awk -F: '($0 ~ /primary/) {print $1; exit}')
|
||||
case $NUMS in
|
||||
1)
|
||||
MONITOR=$PRIMARY polybar --reload alone &
|
||||
;;
|
||||
*)
|
||||
MONITOR=$PRIMARY polybar --reload primary &
|
||||
for MONITOR in $(polybar --list-monitors | awk -F: '($0 !~ /primary/) {print $1}'); do
|
||||
export MONITOR
|
||||
polybar --reload secondary &
|
||||
done
|
||||
;;
|
||||
esac
|
||||
wait
|
||||
|
|
|
@ -6,7 +6,7 @@ highlight = #4c7899
|
|||
[settings]
|
||||
screenchange-reload = false
|
||||
|
||||
[bar/secondary]
|
||||
[bar/common]
|
||||
enable-ipc = true
|
||||
width = 100%
|
||||
height = ${env:HEIGHT:}
|
||||
|
@ -27,11 +27,19 @@ font-1 = Font Awesome 5 Pro:style=Solid:size=10;2
|
|||
font-2 = Font Awesome 5 Brands:style=Regular:size=10;2
|
||||
|
||||
modules-left = i3
|
||||
modules-right = pulseaudio date
|
||||
|
||||
[bar/alone]
|
||||
inherit = bar/common
|
||||
modules-right = cpu memory brightness battery ethernet wlan pulseaudio date
|
||||
|
||||
[bar/primary]
|
||||
inherit = bar/secondary
|
||||
modules-right = cpu memory pulseaudio brightness battery ethernet wlan date
|
||||
inherit = bar/common
|
||||
modules-right = cpu memory brightness battery pulseaudio date
|
||||
|
||||
[bar/secondary]
|
||||
inherit = bar/common
|
||||
modules-right = ethernet wlan pulseaudio date
|
||||
|
||||
|
||||
[module/i3]
|
||||
type = internal/i3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue