younggift/argus — pull request #2 by CallumCameron (2014-06-15 12:56:26+00:00)
Title: Updated xrandr -q parsing to work with new output format.

The output format of xrandr -q changed slightly in recent versions (notice the 'primary' after 'connected' in DVI-0):

Screen 0: minimum 320 x 200, current 2560 x 1024, maximum 8192 x 8192
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
DVI-0 connected primary 1280x1024+0+0 (normal left inverted right x axis y axis) 359mm x 287mm
1280x1024 60.0*+
1152x864 75.0
1024x768 75.1 75.0 60.0
832x624 74.6
800x600 75.0 60.3
640x480 75.0 60.0
720x400 70.1
DVI-1 connected 1280x1024+1280+0 (normal left inverted right x axis y axis) 338mm x 270mm
1280x1024 60.0*+
1152x864 75.0
1024x768 75.1 75.0 60.0
832x624 74.6
800x600 75.0 60.3
640x480 75.0 60.0
720x400 70.1

This patch updates monitor_switch.sh so that it works with the new format (and should still work with the old one). The new format is used in (at least) Mint 16 and above, and probably other distros too.