Environment:NVidia video card with NVidia drivers. Debian 8. Multiple monitorsI currently have 2 screens connected to my computer. Usually (while working) I like to use both. Sometimes (while gaming) I only want one to be active.Actually there is a third usecase (watching movie on a projector, while screen 1 and 2 are off) but let's ignore that for now.What I am looking for is a simple way (cli command, script that can be tied to e.g a hotkey, etc) to change the X server configuration. I can use nvidia-settings to change the configuration, but that is a clicky interface and I am looking for the one-button solution. Does not matter if the configuration sticks across reboots (preferred would be only temporary change)
Change X server configuration at runtime
x11;xorg;nvidia;x server
The tool you are looking for is 'xrandr'. Running xrandr without parameters gives you the list of known outputs, attached devices, available resolutions (including preferred ones and used ones).For example, to deactivate an output, runxrandr --output NAME-OF-OUTPUT --offTo set an output to on and its preferred resolution, runxrandr --output NAME-OF-OUTPUT --autoOr to a specific, supported resolutionxrandr --output NAME-OF-OUTPUT --mode 1024x768There are many more options, just look into the man pages.Collect your xrandr commands in shell scripts and configure your system to execute those scripts upon hotkey press.