1

I use my laptop with multiscreen: laptop screen on one side, my TV displaying my media center (Kodi) on the other side. Problem, when I use my media center to watch a movie, the laptop screen never switch to sleep mode.

I'm looking for a command to sleep the laptop screen, but ONLY this screen, and go out of this mode by using the touchpad. I was thinking to use xrandr, but it seems I can only deactivate (with option --off) the screen, and not just sleep it.

Any idea that would help?

Jacob Vlijm
  • 85,475
cyanat
  • 29

2 Answers2

3

Toggle- dim a specific screen

The command to dim the screen (not switch off, but not "sleep" either) would be:

xrandr --output $monitor --brightness 0

You can however easily toggle- dim the targeted screen with a keyboard shortcut. Add the script below to a shortcut:

#!/bin/bash
# --- set your monitor below
monitor=VGA-0
# ---
if [ -z "$(xrandr --verbose | grep 'Brightness: 0.0')" ]; then
  xrandr --output $monitor --brightness 0
else
  xrandr --output $monitor --brightness 1
fi

To use

  • Copy the script into an empty file, save it as dim_screen.sh, and make it executable
  • In the head of the script, set the name of your targeted screen. Run the command xrandr to find out if you don't know.
  • Add it to a shortut key: Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
    /path/to/dim_screen.sh

Explanation

The test:

[ -z "$(xrandr --verbose | grep 'Brightness: 0.0')" ]

will see if the command xrandr --verbose | grep 'Brightness: 0.0' has an output, in other words, if your screen is dimmed. If so, it will set the targeted screen to "normal" brightness (1.0):

xrandr --output $monitor --brightness 1

...else it will dim the screen with the command:

xrandr --output $monitor --brightness 0

Note

It seems impossible to only put a specific screen to sleep. This answer is written, assuming you want the screen, dimmed, but switching it off, including the black out of both screens, is too much a fuzz.

Jacob Vlijm
  • 85,475
0

From How do I turn off the backlight but leave the LCD on?:

$ sudo -i
# Turn backlight off
echo 4 > /sys/class/backlight/intel_backlight/bl_power
# Turn backlight on
echo 0 > /sys/class/backlight/intel_backlight/bl_power
exit
$

I've just tried this and it works fine on my laptop.