Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-02-20 10:32:12

orschiro
Member
Registered: 2017-11-30
Posts: 65

How to query the current display brightness level from the terminal?

Hi all,

Is there an Xfce-specific command to get the current display brightness that I can also see from the screenshot below?

rYdMyZQ.png

Thank you! :-)

Last edited by orschiro (2019-02-20 10:32:30)

Offline

#2 2019-02-20 10:57:57

alcornoqui
Member
Registered: 2014-07-28
Posts: 832

Re: How to query the current display brightness level from the terminal?

Not Xfce specific, but try:

cat /sys/class/backlight/*/brightness

Offline

#3 2019-02-20 11:21:43

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,491

Re: How to query the current display brightness level from the terminal?

You can also use xfpm-power-backlight-helper:

xfpm-power-backlight-helper --get-brightness

It will display the value for backlight interface that xfce4-power-manager is using.

You can also manipulate values. See:

xfpm-power-backlight-helper --help

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#4 2019-02-20 14:00:58

orschiro
Member
Registered: 2017-11-30
Posts: 65

Re: How to query the current display brightness level from the terminal?

ToZ wrote:

You can also use xfpm-power-backlight-helper:

xfpm-power-backlight-helper --get-brightness

It will display the value for backlight interface that xfce4-power-manager is using.

You can also manipulate values. See:

xfpm-power-backlight-helper --help

@ToZ this is great, thanks!

Follow-up question. Is it possible to set brightness without being root?

[orschiro@x230 ~]$ xfpm-power-backlight-helper --set-brightness 3000
This program can only be used by the root user

Offline

#5 2019-02-20 18:35:22

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,491

Re: How to query the current display brightness level from the terminal?

Follow-up question. Is it possible to set brightness without being root?

Not directly, no. The backlight interface is protected by the system so that only root can write to it.

If you use sudo, you can create a no-password rule to allow you to execute the command without being prompted for a password. To do so, create the file (as root) /etc/sudoers.d/xfpm-power-backlight-helper with the following content:

%wheel ALL=(ALL) NOPASSWD: /usr/bin/xfpm-power-backlight-helper

...and call the executable still with sudo like:

sudo xfpm-power-backlight-helper --set-brightness 3000

...and you won't be asked for a password.

Notes on the /etc/sudoers.d/xfpm-power-backlight-helper file:

  1. "%wheel" indicates any member of the wheel group can execute the command without being prompted for a password. If your distro uses the "sudo" group, replace "%wheel" with "%sudo". You can also just specify a single user to have this right. In that case, replace "%wheel" with your username (no %) - like "toz".

  2. It assumes that the xfpm-power-backlight-helper executable is in /usr/bin. If it is in another place, change the path.

Detailed info about sudo and sudoers configuration can be found here.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#6 2019-02-21 09:29:43

orschiro
Member
Registered: 2017-11-30
Posts: 65

Re: How to query the current display brightness level from the terminal?

@ToZ much appreciate your help and advice. Thank you! ❤

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 535.95 KiB (Peak: 536.8 KiB) ]