Skip to content

Instantly share code, notes, and snippets.

@pirogoeth
Created March 6, 2018 05:09
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 pirogoeth/5f4f1124dfece5e84052173ab18cefc0 to your computer and use it in GitHub Desktop.
Save pirogoeth/5f4f1124dfece5e84052173ab18cefc0 to your computer and use it in GitHub Desktop.
AWK script for matching display modes from `xrandr --query`
BEGIN {
matched = 0;
if (!display) {
print "No display variable set";
exit;
}
}
# Matches modelines
match($0, /^[[:blank:]]+/) {
if (matched == 1) {
print $0;
next;
}
}
match($0, display) {
matched = 1;
next;
}
{
matched = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment