1

I usually run two monitors. Sometimes I'd like to turn off only the primary (laptop) screen. My old Asus laptop had an fn key for this until recently (I don't know why, but it started putting the laptop to sleep instead).

I could do this by changing to external screen only. However not only this resets the joint screen setting but also moves all the laptop apps to the external screen.

Any ideas? Ideally I'd have this macro called from one of the fn keys (current laptop has 3 "empty" ones).

Peter C
  • 11

1 Answers1

2

As demonstrated by this script you can turn off laptop screen:

To discover the power setting for your laptop display use:

$ ls /sys/class/backlight/*/bl_power

/sys/class/backlight/intel_backlight/bl_power

On my laptop the driver name is intel_backlight

Move your terminal window to your external screen and turn off your laptop display with:

echo 4 | sudo tee /sys/class/backlight/intel_backlight/bl_power

or a shorter version without specifying the name should work for all laptops:

echo 4 | sudo tee /sys/class/backlight/*/bl_power

To turn the screen back on:

echo 0 | sudo tee /sys/class/backlight/*/bl_power

You can also get a list of your monitors for xrandr software control:

$ xrandr | grep " connected"
HDMI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 1107mm x 623mm
eDP-1-1 connected primary 1920x1080+3840+2160 (normal left inverted right x axis y axis) 382mm x 215mm
DP-1-1 connected 3840x2160+1920+0 (normal left inverted right x axis y axis) 1600mm x 900mm

xrandr allows you to turn off a screen but then all windows will move to the screen that is left turned on which is what you don't want.