Skip to content

Instantly share code, notes, and snippets.

@mdellabitta
Created November 29, 2012 20:23
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 mdellabitta/4171654 to your computer and use it in GitHub Desktop.
Save mdellabitta/4171654 to your computer and use it in GitHub Desktop.
Simple script for autodetecting number of displays and switching between xrandr/arandr layouts
#!/usr/bin/env ruby
output = `xrandr --query`
ids = output.lines.find_all do |line|
line =~ /\sconnected/
end
if ids.size == 1
`~/.screenlayout/Mobile.sh`
else
`~/.screenlayout/Desktop.sh`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment