Skip to content

Instantly share code, notes, and snippets.

@angdraug
Created January 5, 2016 04:09
Show Gist options
  • Save angdraug/edbe2a14a4c6e78bc253 to your computer and use it in GitHub Desktop.
Save angdraug/edbe2a14a4c6e78bc253 to your computer and use it in GitHub Desktop.
Detect and enable external display's preferred resolution
#!/bin/bash
INTERNAL=eDP1
COMMAND=$(xrandr |awk '/^Screen|^'$INTERNAL'|disconnected/ { output=0; next }
/\<connected\>/ { output=$1 }
/^ /{if(output && $0 ~ /+/) print "xrandr --output "output" --mode "$1" --above '$INTERNAL'"}')
[ -n "$COMMAND" ] && $COMMAND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment