Created
November 30, 2019 22:05
-
-
Save markuskont/48337614d6a1092291af0e014b1450d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/markus/.Xauthority", RUN+="/usr/share/markus/hotplug-monitor.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/bash | |
export DISPLAY=:0 | |
export XAUTHORITY=/home/markus/.Xauthority | |
IN=LVDS-1 | |
OUT1=DP-1 | |
OUT2=HDMI-1 | |
function connect(){ | |
xrandr --output $OUT1 --right-of $IN --preferred --primary --output $IN --auto | |
} | |
function disconnect(){ | |
xrandr --output $OUT1 --off --output $OUT2 --off --output $IN --auto --primary | |
} | |
#xrandr | grep "HDMI1 connected" &> /dev/null && connect || disconnect | |
xrandr | egrep "($OUT1|$OUT2) connected" &> /dev/null && connect || disconnect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment