Simply put, is there an inverse to the following command?:
xrandr --output VIRTUAL1 --off
This command cuts off my virtual display output to my external monitor, but I would like to reinitialize my virtual display output as well.
DETAILS:
I am using the solution to configuring external monitor on Nvidia Optimus machines here.
I am having trouble moving between single (laptop) display and extended monitors using xrandr. I use the following script to move to a single monitor setup:
xorg_process=$(ps aux | grep 'Xorg' | grep -v grep | awk '{print $2}')
sudo kill -15 $xorg_process
sudo rmmod nvidia
sudo tee /proc/acpi/bbswitch <<<OFF
xrandr --output VIRTUAL1 --off
and moving back to external monitors (without rebooting), I use this script:
sudo tee /proc/acpi/bbswitch <<<ON
sudo modprobe bbswitch
optirun true
intel-virtual-output
xrandr
Yet I get the following error at optirun true
:
[16929.676769] [ERROR]Cannot access secondary GPU - error: [XORG] (EE) Server terminated successfully (0). Closing log file.
[16929.676811] [ERROR]Aborting because fallback start is disabled.
If I remove the line xrandr --output VIRTUAL1 --off
in the first script, then I am able to execute both scripts to switch back and forth between two and one monitor setups without error, except that the one monitor setup still 'sees' the external monitor without displaying it. So, I need xrandr --output VIRTUAL1 --off
to cut off the virtual display, but I also need to reinitialize it as well. Is there a way to undo the command xrandr --output VIRTUAL1 --off
when moving back to external monitor setup?
Best Answer