Created
July 14, 2014 18:16
-
-
Save niklas/cf96ee8e9267fe5ac1f7 to your computer and use it in GitHub Desktop.
Setup correct resolutions based on connected displays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
def dpi | |
147 | |
end | |
def desktop | |
system "xrandr --output VGA1 --auto --left-of LVDS1 --output LVDS1 --auto --primary --dpi #{dpi}" | |
system "xset dpms force on" # wake up monitor from power saving mode | |
system "marble-mouse left" | |
end | |
def auto | |
system "xrandr --auto --dpi #{dpi}" | |
end | |
def main | |
if system "xrandr | grep -q 'VGA1 connected'" | |
desktop | |
else | |
auto | |
end | |
system 'xset dpms force on' # wake up monitor from power saving mode | |
end | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment