Skip to content

Instantly share code, notes, and snippets.

@ilyaevseev
Created September 27, 2014 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyaevseev/74c0f9def3e8cd2b8ad8 to your computer and use it in GitHub Desktop.
Save ilyaevseev/74c0f9def3e8cd2b8ad8 to your computer and use it in GitHub Desktop.
One-liner for setting maximum available X11 display resolution using xrandr.
#!/bin/sh
xrandr | perl -ne '
BEGIN { my ($x, $y) = (0, 0) }
END { printf "%sx%s\n", $x, $y if $x and $y }
/^\s+(\d+)x(\d+)\s+\d/ && ($1 + $2 > $x + $y) && (($x, $y) = ($1, $2));
' | xargs -r xrandr -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment