[Sovled] How to disable screen on laptop when using it via ssh?

Issues related to hardware problems
Post Reply
m0t0m
Posts: 22
Joined: 2017/01/04 10:05:56

[Sovled] How to disable screen on laptop when using it via ssh?

Post by m0t0m » 2020/09/13 19:41:06

I am using my laptop as an CentOS 8.2 server. I would like to disable the display as I am only accessing it via ssh.
The laptop is a Dell Inspiron 1545 running CentOS Linux release 8.2.2004 (Core)

So far I have tried:
  • xrandr --output CRT1 --off
Any ideas?
Last edited by m0t0m on 2020/09/28 10:15:49, edited 1 time in total.

User avatar
KernelOops
Posts: 347
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: How to disable screen on laptop when using it via ssh?

Post by KernelOops » 2020/09/13 20:20:45

I had to do something similar, disable the laptop display because I was using an external monitor.

The way to do that, I had to ssh to the laptop as the user that was logged in as a GUI user (thus had permission to use xrandr) and discover the name of the laptop display:

Code: Select all

ssh user@laptop
$ DISPLAY=:0
$ export DISPLAY
$ xrandr | grep connected
eDP-1 connected
HDMI-1 connected
Now I know that eDP-1 is the laptop display and HDMI-1 is the external monitor. Now I can disable the laptop display by name. Reconnect and run:

Code: Select all

ssh user@laptop
$ DISPLAY=:0
$ export DISPLAY
$ xrandr --output eDP-1 --off
That works for me over ssh, but it does not work if I try that as a cronjob. I believe the correct way would be some kind of kernel argument in GRUB2.
--
I love my computer - all my friends live there.
--

m0t0m
Posts: 22
Joined: 2017/01/04 10:05:56

Re: How to disable screen on laptop when using it via ssh?

Post by m0t0m » 2020/09/14 11:19:42

I don't have Xwindow installed as I only use the shell.

When I use your commands I get

Code: Select all

[user@localhost ~]$ DISPLAY=:0
[user@localhost ~]$ export DISPLAY
[user@localhost ~]$ xrandr | grep connected
Can't open display :0

m0t0m
Posts: 22
Joined: 2017/01/04 10:05:56

Re: How to disable screen on laptop when using it via ssh?

Post by m0t0m » 2020/09/25 16:59:15

OK it works.

I installed added a GUI to my CentOS install and then your commands worked as you described.

Code: Select all

$ DISPLAY=:0
$ export DISPLAY
$ xrander | grep connected
LVDS-1 connected primary (normal left inverted right x axis y axis)
VGA-1 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
$ xrandr --output LVDS-1 --off
However I need the GUI to be able to run the commands. So I made CentOS boot into GUI mode, and now the screen turns off on its own when I do use it for a while.

Post Reply

Return to “CentOS 8 - Hardware Support”