Improve switching primary and secondary display

This commit is contained in:
Alexander Grothe
2018-09-30 10:17:20 +02:00
parent cd10eb1970
commit 2d966364e5
5 changed files with 535 additions and 473 deletions

View File

@@ -0,0 +1,9 @@
#!/bin/bash
source <(systemctl --user show-environment)
SECOND_DISPLAY="${DISPLAY%\.[0-9]*}.1"
if xrandr -d "$SECOND_DISPLAY" -q | grep -q "connected"; then
[ "$DISPLAY" != "$SECOND_DISPLAY" ] && d="DISPLAY=$SECOND_DISPLAY" || d="DISPLAY=$DISPLAY"
echo "$d" > ~/.second_display;
else
rm -f ~/.second_display
fi