I have a laptop with Ubuntu 15.04 installed and an external VGA monitor connected and I usually turn my laptop screen off and use only the external monitor, but whenever I want to use only the laptop screen I need to go through the tedious routine of clicking preferences>displays>external monitor:off> built-in screen: on, so I thought about writing a simple script to do this for me and create a shortcut from my desktop so I can swap monitors by clicking an executable. How can I write a script to accomplish the following tasks?
1- detect which monitors are on or off;
2- if built-in screen is on, turn it off and turn external monitor on; else, turn external monitor off and built-in screen on;
I tried this:
#!/bin/bash #swap from external monitor to laptop screen xrandr --output LVDS-0 --auto xrandr --output VGA-0 --off #swap from laptop screen to external monitor #xrandr --output VGA-0 --auto #xrandr --output LVDS-0 --off
but the terminal returns me an error:"warning: output LVDS-0 not found; ignoring". Could someone help? Thanks in advance.