Created
August 27, 2014 22:02
-
-
Save hh/55eed67c5c5a27f555cc to your computer and use it in GitHub Desktop.
Detecting external monitor changes and reconfiguring X Displays and reloading Window manager on Arch MacBookAir5,2
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
# put this in /etc/udev/rules.d | |
# It's important that it starts with 99 or something high | |
# If this file is 10-local.rules it will fail to run the scripts | |
ACTION=="change", SUBSYSTEM=="drm", RUN+="/etc/udev/monitor.change.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
#!/bin/bash | |
status="$(cat /sys/class/drm/card0-HDMI-A-1/status)" | |
enabled="$(cat /sys/class/drm/card0-HDMI-A-1/enabled)" | |
export DISPLAY=:0 | |
export XAUTHORITY=/home/hh/.Xauthority | |
if [ "${status}" = disconnected ]; then | |
if [ "${enabled}" = enabled ]; then | |
/usr/bin/xrandr --auto | |
killall awesome -SIGHUP | |
fi | |
elif [ "${status}" = connected ]; then | |
if [ "${enabled}" = disabled ]; then | |
/usr/bin/xrandr --output HDMI1 --auto --left-of eDP1 | |
killall awesome -SIGHUP | |
fi | |
else | |
/usr/bin/xrandr --auto | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment