Files
dotfiles/.config/polybar/launch.sh
druckdev 6cdabb78be 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).
2020-06-25 23:20:08 +02:00

19 lines
529 B
Bash
Executable File

#!/bin/sh
# 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
primary="$(xrandr -q | grep primary | cut -d' ' -f1)"
for m in $(polybar --list-monitors | cut -d':' -f1); do
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