I have a dual monitor setup. The problem is that 50% of the time I don't need my second monitor, and as such I will "turn it off" (i.e. press the power button ⏻) which results in the screen going in standby mode.
The problem is: my system still thinks that the monitor is displaying stuff and hence will try to open windows on that monitor, even modal dialogs triggered by applications display in the active monitor, which sometimes is really confusing if you open them by mistake with some shortcut and suddenly you can't do anything.
I would like my OS to detect the monitor and simply do not consider it. Basically when I press the power off button the setup of the monitor should go into single-monitor state (i.e. no windows will be opened on that monitor and any window open there should go in the opened monitor but in the background), and when I turn it on again it should change to dual-monitor state.
Is this possible at all? I believe some kind of signal arrives to the kernel so it ought to be possible to at least write a daemon that keeps track of which monitors are displaying and which not.
My system is:
- Kubuntu 18.04
- GPU: Nvidia 1080
- Dual monitors connected via DisplayPorts connected to the GPU