Multi monitor support
When restarting i3 check for connected second monitor: scale it and restart polybar if there is one. Put polybar tray on the main monitor. Do not kill polybar and relaunch it when restarting i3, but restart it using ipc (much faster).
This commit is contained in:
@@ -24,7 +24,7 @@ modules-left = i3 pulseaudio xbacklight battery-custom
|
||||
modules-center = datetime
|
||||
modules-right = vpn wlan bluetooth powermenu
|
||||
|
||||
tray-position = right
|
||||
tray-position = ${env:TRAY_POS:right}
|
||||
tray-detached = false
|
||||
tray-scale = 1.0
|
||||
|
||||
@@ -36,10 +36,13 @@ foreground = ${colors.foreground}
|
||||
line-size = 3
|
||||
line-color = ${colors.primary}
|
||||
|
||||
enable-ipc = true
|
||||
|
||||
;#################################################
|
||||
|
||||
[module/i3]
|
||||
type = internal/i3
|
||||
pin-workspaces = true
|
||||
format = <label-state> <label-mode>
|
||||
index-sort = true
|
||||
wrapping-scroll = false
|
||||
|
||||
@@ -3,10 +3,16 @@
|
||||
# if there is no running instance
|
||||
if ! pgrep -ax polybar >/dev/null 2>&1; then
|
||||
# launch Polybar on every monitor
|
||||
# https://github.com/polybar/polybar/issues/763#issuecomment-392960721
|
||||
# https://github.com/polybar/polybar/issues/763
|
||||
primary="$(xrandr -q | grep primary | cut -d' ' -f1)"
|
||||
for m in $(polybar --list-monitors | cut -d':' -f1); do
|
||||
MONITOR=$m polybar --reload -c "$HOME/.config/polybar/config" main &
|
||||
export TRAY_POS=none
|
||||
[ "$m" != "$primary" ] || export TRAY_POS=right
|
||||
export MONITOR="$m"
|
||||
polybar --reload -c "${XDG_CONFIG_HOME:-$HOME/.config}/polybar/config" main &
|
||||
done
|
||||
|
||||
echo "Polybar launched..."
|
||||
else
|
||||
polybar-msg cmd restart
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user