Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shell script to programmatically list xrandr output modes
#!/bin/sh
output=""
xrandr | while read line; do
if echo "${line}" | grep 'connected' > /dev/null; then
if echo "${line}" | grep ' connected' > /dev/null; then
output="$( echo "${line}" | sed 's/\(.*\) connected.*/\1/' )"
fi
elif ! echo "${line}" | grep '^Screen' > /dev/null; then
echo "${output}:$( echo "${line}" | awk '{ print $1 }' )"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment