Remotely turn off display output?

8,504

Solution 1

You should be able to use xrandr to turn off a given display.

$ xrandr --output CRT1 --off

To re-enable it:

$ xrandr --output CRT1 --auto

You can see the names of your output displays using xrandr -q:

$ xrandr -q
Screen 0: minimum 320 x 200, current 1440 x 900, maximum 8192 x 8192
LVDS1 connected primary 1440x900+0+0 (normal left inverted right x axis y axis) 303mm x 190mm
   1440x900       60.0*+   50.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
HDMI3 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)

References

Solution 2

xrandr removes display from active thus it also makes problem with view-port resolution. The better way is to force screen power save mode with vbetool. The following command blackens screen by sending power save command to graphic card:

vbetool dpms off

To get back from power save run:

vbetool dpms on

Mind the fact that your input devices like keyboard or mouse are still active and somebody may interact with your remote machine. To disable these device please see Disable Keyboard & Mouse input on unix (under X).

Share:
8,504
Naftuli Kay
Author by

Naftuli Kay

Updated on September 18, 2022

Comments

  • Naftuli Kay
    Naftuli Kay over 1 year

    I'm using x11vnc and SSH to tunnel VNC remotely to my local machine.

    One of the interesting side-effects of this is that as I use my work computer from home, my coworkers will see me moving around my mouse, typing, etc. and can stand at my computer in the office and spectate everything.

    Is there a way for me to disable display output remotely but still be able to VNC into my actual desktop as I left it? Preferably, stopping keyboard and mouse input for the duration of the session would be a good idea™.

  • slm
    slm almost 10 years
    @NaftuliTzviKay - when connected does it switch the desktop size on the fly, or for connections after the above command has been run?
  • Naftuli Kay
    Naftuli Kay almost 10 years
    Connections afterward. In one SSH command, I disabled the monitor, then I reconnected with port forwarding and x11vnc.
  • slm
    slm almost 10 years
    @NaftuliTzviKay - pre-existing connections maintain the resolution though, right? I'm only clarifying so I can try and replicate the scenario 8-). Also what method are you doing the tunneling? Is it using the via method that I detailed before? I think it was for one of your other Q's if I'm not mistaken?
  • Naftuli Kay
    Naftuli Kay almost 10 years
    Yes, see my new answer to that question here. Perhaps I need to write a script which will turn off the display, then immediately start x11vnc, and then trap the exit signal to turn back on the display...
  • slm
    slm almost 10 years
    @NaftuliTzviKay - perhaps, but that feels like a lot of bending over backwards. What if you explicitly tell x11vnc -configure 1024x600 or whatever size you want?
  • Naftuli Kay
    Naftuli Kay almost 10 years
    Migrating this to a new question.