Last active
April 8, 2020 18:34
-
-
Save zoe1337/2129d5cefe74e662b250064c681a0e3a to your computer and use it in GitHub Desktop.
Zoé's xrandr handler script
This file contains hidden or 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 | |
# call srandrd /path/to/display-handler.sh in your xorg startup scripts (in my case from rc.lua) | |
RESOLUTION="1366x768" | |
LOCKFILE=/tmp/display-handler.lock | |
if [[ -a $LOCKFILE ]] | |
then | |
sleep 4s | |
else | |
touch $LOCKFILE | |
TMPFILE="/tmp/srandrd-$(whoami)" | |
echo $SRANDRD_ACTION > $TMPFILE | |
OUTPUT=$(echo $SRANDRD_ACTION | cut -d " " -f 1) | |
ACTION=$(echo $SRANDRD_ACTION | cut -d " " -f 2) | |
INTERNAL="LVDS1" | |
notify-send "$SRANDRD_ACTION" "display-handler adjusts the output accordingly" | |
case "$ACTION" in | |
"disconnected") | |
xrandr --output $INTERNAL --primary | |
xrandr --output $OUTPUT --off | |
;; | |
"connected") | |
#xrandr --output $OUTPUT -r 50 --above $INTERNAL --auto # minimonitor | |
#xrandr --output $OUTPUT --primary --right-of $INTERNAL --auto #setup at home | |
#xrandr --output $OUTPUT --left-of LVDS1 --auto --size $RESOLUTION | |
xrandr --output $OUTPUT --right-of LVDS1 --auto --size $RESOLUTION | |
sleep 3s | |
feh --bg-scale $HOME/.config/awesome/astech/astech-background.png | |
;; | |
esac | |
sleep 4s | |
trackpoint-setup | |
tablet-setup | |
thinkpad-touchpad on | |
rm $LOCKFILE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment