Files
dotfiles/.config/i3/monitor-setup.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

13 lines
436 B
Bash
Executable File

#!/bin/sh
if [ 1 -lt "$(xrandr -q | grep " connected" | wc -l)" ]; then
# scale second monitor to 3200x1800 and put to the left
xrandr --output eDP1 --auto --pos 3200x0 --primary --output DP1 --auto --scale-from 3200x1800 --pos 0x0 --fb 6400x1800
killall -q polybar
while pgrep -x polybar >/dev/null; do sleep 1; done
else
xrandr --output eDP1 --auto --output DP1 --off
fi
"${XDG_CONFIG_HOME:-$HOME/.config}/polybar/launch.sh" &