launch script fixed for laptop desktop and multimonitor laptop

This commit is contained in:
Tiago Sousa 2023-05-19 11:52:47 +01:00
parent 0c28e77342
commit 1536c75241
2 changed files with 20 additions and 18 deletions

View file

@ -25,8 +25,9 @@ pseudo-transparency = true
[section/base]
monitor = ${env:MONITOR:eDP1}
tray-position = ${env:TRAY_POS:right}
[bar/main]
[bar/laptop]
inherit = section/base
width = 99.4%
height = 24pt
@ -50,8 +51,6 @@ font-2 = Inter:size=10:weight=regular;2
cursor-click = pointer
enable-ipc = true
tray-position = right
override-redirect = true
wm-restack = i3
@ -83,7 +82,7 @@ enable-ipc = true
override-redirect = true
wm-restack = i3
[bar/laptop]
[bar/desktop]
inherit = section/base
width = 99.4%
height = 24pt
@ -91,9 +90,9 @@ offset-x = 0.3%
offset-y = 0.7%
;radius = 8
modules-left = i3
modules-left = i3 sep title
modules-center = date dot time
modules-right = cpu dot memory dot pulseaudio sep filesystem
modules-right = cpu dot gpu dot memory dot pulseaudio sep filesystem
background = ${colors.base}
foreground = ${colors.text}

View file

@ -8,17 +8,20 @@ while pgrep -x polybar >/dev/null; do sleep 1; done
screens=$(xrandr --listactivemonitors | grep -v "Monitors" | cut -d" " -f6)
if [[ $(xrandr --listactivemonitors | grep -v "Monitors" | cut -d" " -f4 | cut -d"+" -f2- | uniq | wc -l) == 1 ]]; then
MONITOR=$(polybar --list-monitors | cut -d":" -f1) TRAY_POS=right polybar main &
if [[ $(hostnamectl | grep Chassis | awk '{print $2}') == "laptop" ]]; then
if [[ $(xrandr --listactivemonitors | grep -v "Monitors" | cut -d" " -f4 | cut -d"+" -f2- | uniq | wc -l) == 1 ]]; then
MONITOR=$(polybar --list-monitors | cut -d":" -f1) TRAY_POS=right polybar laptop &
else
primary=$(xrandr --query | grep primary | cut -d" " -f1)
for m in $screens; do
if [[ $primary == "$m" ]]; then
MONITOR=$m TRAY_POS=right polybar laptop &
else
MONITOR=$m TRAY_POS=none polybar secondary &
fi
done
fi
else
primary=$(xrandr --query | grep primary | cut -d" " -f1)
for m in $screens; do
if [[ $primary == "$m" ]]; then
MONITOR=$m TRAY_POS=right polybar main &
else
MONITOR=$m TRAY_POS=none polybar secondary &
fi
done
MONITOR=$(polybar --list-monitors | cut -d":" -f1) TRAY_POS=right polybar desktop &
fi