Skip to content

Instantly share code, notes, and snippets.

@dinoocch
Created July 23, 2015 01:34
Show Gist options
  • Save dinoocch/3b853ed9132d818fb0dc to your computer and use it in GitHub Desktop.
Save dinoocch/3b853ed9132d818fb0dc to your computer and use it in GitHub Desktop.
Shell Script to set resolution and arrange monitors.
#!/bin/bash
connectedOutputs=$(xrandr | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/")
execute="xrandr "
previous=""
for display in $connectedOutputs
do
# Turn on and set resolution of the monitorsr
execute=$execute"--output $display --auto "
if [ "$previous" != "" ]
then
execute=$execute"--right-of "$previous
fi
previous="$display"
done
echo "Command: $execute"
`$execute`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment