# Display backlight control

**URL:** <https://community.mnt.re/t/display-backlight-control/350>\
**Category:** MNT Reform\
**Created:** [July 13, 2021, 9:24pm UTC](https://community.mnt.re/t/display-backlight-control/350 "2021-07-13T21:24:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![technomancy](https://community.mnt.re/user_avatar/community.mnt.re/technomancy/32/20_2.png) [@technomancy](https://community.mnt.re/u/technomancy)\
**Post date:** [July 13, 2021, 9:24pm UTC](https://community.mnt.re/t/display-backlight-control/350/1 "2021-07-13T21:24:41Z")

</div>

I’m having trouble with what to do with my Reform when I’m not using it. Suspend is too unreliable for now (see [Investigate Sleep/Hibernate/Wake (#8) · Issues · Reform / reform · GitLab](https://source.mnt.re/reform/reform/-/issues/8)) so I’ve installed `xfce4-screensaver` which blanks the screen when idle. Unfortunately it does not turn off the display backlight.

Has anyone found a manual way to control the display backlight? I don’t even really need it to be triggered on idle; I could just bind one key to enable it and one to disable it and it would still be a big improvement over what I’m doing now.

---

<div class="post-metadata">

**Author:** ![johkra](https://community.mnt.re/letter_avatar_proxy/v4/letter/j/9fc348/32.png) [@johkra](https://community.mnt.re/u/johkra)\
**Post date:** [July 14, 2021, 5:57am UTC](https://community.mnt.re/t/display-backlight-control/350/2 "2021-07-14T05:57:17Z")

</div>

The backlight is controllable via `/sys/class/backlight/backlight/brightness` with valid values being 0 (off) to 6 (fully on).

You can either write to the file directly or use tools like `brightnessctl` to set the brightness.

Turn off screen:

```auto
$ brightnessctl s 0
Updated device 'backlight':
Device 'backlight' of class 'backlight':
	Current brightness: 0 (0%)
	Max brightness: 6

```

Or:

```auto
echo 0 > /sys/class/backlight/backlight/brightness

```

To turn it back on, write a value between 1 and 6 instead.

If you can execute commands as root, you can also use bl\_power:

```auto
# echo 4 > /sys/class/backlight/backlight/bl_power # Turn off
# echo 0 > /sys/class/backlight/backlight/bl_power # Turn back on

```

See [Backlight support — The Linux Kernel documentation](https://www.kernel.org/doc/html/latest/gpu/backlight.html) for more details.

---

<div class="post-metadata">

**Author:** ![ruff](https://community.mnt.re/user_avatar/community.mnt.re/ruff/32/306_2.png) [@ruff](https://community.mnt.re/u/ruff)\
**Post date:** [July 14, 2021, 10:37am UTC](https://community.mnt.re/t/display-backlight-control/350/3 "2021-07-14T10:37:06Z")

</div>

You can use swayidle to do it for you, but I’d imaging xfce4 to be doing the same thing.  
Assuming you use sway - what happens if you do `swaymsg "output * dpms off"` - does it turn backlight off or just dims the brightness to 0?

---

<div class="post-metadata">

**Author:** ![johkra](https://community.mnt.re/letter_avatar_proxy/v4/letter/j/9fc348/32.png) [@johkra](https://community.mnt.re/u/johkra)\
**Post date:** [July 14, 2021, 4:02pm UTC](https://community.mnt.re/t/display-backlight-control/350/4 "2021-07-14T16:02:35Z")

</div>

I just tested this, and it sets `/sys/class/backlight/backlight/bl_power` to 4. It does not change the brightness.

It also does something else as writing 0 to bl\_power doesn’t turn the backlight back on. Keyboard input or moving the mouse cursor doesn’t either, but `swaymsg "output * dpms on` works.

I don’t have Xorg installed anymore, but I remember `xset dpms force off` doing something similar, but moving the mouse or key input would turn the screen back on.

---

<div class="post-metadata">

**Author:** ![ruff](https://community.mnt.re/user_avatar/community.mnt.re/ruff/32/306_2.png) [@ruff](https://community.mnt.re/u/ruff)\
**Post date:** [July 14, 2021, 4:15pm UTC](https://community.mnt.re/t/display-backlight-control/350/5 "2021-07-14T16:15:31Z")

</div>

That’s where swayidle comes to picture:

```auto
$ grep idle ~/.config/sway/config 
# make sure to add -f to lock otherwise it won't release the idle pipeline till unlocked
exec_always --no-startup-id swayidle -w timeout 600 'swaylock -fei /usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg' timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -fei /usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg'

```

---

<div class="post-metadata">

**Author:** ![technomancy](https://community.mnt.re/user_avatar/community.mnt.re/technomancy/32/20_2.png) [@technomancy](https://community.mnt.re/u/technomancy)\
**Post date:** [July 14, 2021, 4:36pm UTC](https://community.mnt.re/t/display-backlight-control/350/6 "2021-07-14T16:36:21Z")

</div>

> I don’t have Xorg installed anymore, but I remember `xset dpms force off` doing something similar

Unfortunately this gives “server does not have extension for dpms option”

Similarly, xfce4-screensaver when it blanks the screen gives this output: Xlib: extension “DPMS” missing on display “:0”

But that’s OK; being able to manually blank the screen with `brightnessctl` is good enough for now. Thanks!

---

<div class="post-metadata">

**Author:** ![minute](https://community.mnt.re/user_avatar/community.mnt.re/minute/32/3_2.png) [@minute](https://community.mnt.re/u/minute)\
**Post date:** [July 14, 2021, 6:35pm UTC](https://community.mnt.re/t/display-backlight-control/350/7 "2021-07-14T18:35:06Z")

</div>

BTW, slightly hidden, but this is mentioned in the handbook: [Graphical Desktops — MNT Reform Operator Handbook documentation](https://mntre.com/reform2/handbook/desktops.html?highlight=brightnessctl#display-brightness)
