HOw to darken/turn off only one screen

11 Antworten [Letzter Beitrag]
GNUser
Offline
Beigetreten: 07/17/2013

Hey,

So in my old laptop I had a key that turned off the built-in screen, while still showing image through another screen connected in the VGA port. My T400 librebooted has no such key and when I play a video the main screen (the one built-in) won't go to sleep or turn off whatever. Is there a way I can do it?
If there is a command that I can issue I will be glad to learn it and use it.
I don't want to go to "Menu" "Screens" and turn it off because I want it back on when I move the mouse cursor.

Thanks!

chaosmonk

I am a member!

I am a translator!

Offline
Beigetreten: 07/07/2017

> If there is a command that I can issue I will be glad to learn it and use it.

$ xset dpms force suspend

deactivates the display on my laptop until I type or move the mouse.
However, I haven't tested to see what happens with an external monitor
plugged in.

chaosmonk

I am a member!

I am a translator!

Offline
Beigetreten: 07/07/2017

If that doesn't work, you could just use xrandr to turn the screen on or
off.

First, run

$ xrandr | grep primary

to find out the name of your laptop screen. (I'm assuming that your
laptop screen is your primary display.) For me the output is

$ xrandr | grep primary
LVDS1 connected primary 1280x800+0+0 (normal left inverted right x axis y axis) 261mm x 163mm

so the name of my laptop screen is LVDS1.

I can then turn it off with

$ xrandr --output LVDS1 --off

and on with

$ xrandr --output LVDS1 --auto

Then map these to convenient keyboard shortcuts.

GNUser
Offline
Beigetreten: 07/17/2013

Thanks! As far as I have tested, it works!

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

In the "Displays" utility of GOME Shell, you can click on a screen and choose to deactivate it. I did that once with my built-in screen when my TV set was connected (by HDMI). Now, whenever the TV set is plugged in, the built-in screen is automatically deactivated (what I want). Right after logging in if it is plugged before.

Doesn't the on/off radio buttons in MATE's monitor preferences behave in the same way?

chaosmonk

I am a member!

I am a translator!

Offline
Beigetreten: 07/07/2017

> Doesn't the on/off radio buttons in MATE's monitor preferences behave
> in the same way?

I think that's what GNUser was referring to with

> I don't want to go to "Menu" "Screens" and turn it off because I want
> it back on when I move the mouse cursor.

GNUser
Offline
Beigetreten: 07/17/2013

Exactly

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

I read too fast: sorry.

GNUser
Offline
Beigetreten: 07/17/2013

Wait, it doesn't work :(

It turns out it also disables the secondary display :(

I also tried using xrandr --output LVDS1 --off which corresponds to my laptop screen and it doesn't work properly because it actually disables it.

I have to find a way to use "xset dpms force suspend" in a way that doesn't disable the VGA port.

Any other ideas chaosmonk?

Thanks in advance!

chaosmonk

I am a member!

I am a translator!

Offline
Beigetreten: 07/07/2017

> I also tried using xrandr --output LVDS1 --off which corresponds to my
> laptop screen and it doesn't work properly because it actually disables
> it.

Right. Then you turn it back on with

$ xrandr --output LVDS1 --auto

I would just map those two commands to some convenient shortcuts. A
keyboard shortcut is just as fast as wiggling the mouse, and that way
you can just turn the screen on/off when you want it to be on/off. It's
not exactly what you asked for, but it's a fallback if you can't find
something that does exactly what you want.

chaosmonk

I am a member!

I am a translator!

Offline
Beigetreten: 07/07/2017

> I would just map those two commands to some convenient shortcuts.

Or, if you don't want to have two different shortcuts, the following
script will toggle your display on/off.

#!/bin/bash
display=LVDS1

if xrandr --listactivemonitors | grep $display; then
xrandr --output $display --off
else
xrandr --output $display --auto
fi

GNUser
Offline
Beigetreten: 07/17/2013

Ok, so I have managed to have the screensaver (darkening) come up in laptop screen while still playing video on VGA screen using VLC. HOWEVER I can't do it in firefox. If I can manage to have firefox NOT preventing screensaver mayve it will be done for. Can I adjust it from firefox settings? (by firefox I mean Abrowser, Tor Browser, Icecat, all the firefox derivatives that I make use of).

Thanks