You are not logged in.

#1 2021-01-06 10:32:10

millus
Member
Registered: 2019-07-21
Posts: 244

How to obtain display names used for xbacklight?

From man page:

SYNOPSIS
       xbacklight [-help]  [-display display] [-get] [-set percent] [-inc percent] [-dec percent]

but how to find out what 'display' parameter actually is?

I'm currently trying to solve the problem of nonworking backlight fn keys on my asus notebook.
I found out that everything actually works ALMOST, except that when I manually call xbacklight it works fine but when the /etc/acpi/handler.sh script tries to do the very same thing then xbacklight will suddenly return with an error:
In both cases, manual invocation from terminal and invocation from handler.sh script, the user invoking xbacklight is root and it's this call:

# xbacklight -steps 1 -inc 5%

It will work fine if entered manually in terminal, but will throw error when used in the /etc/acpi/handler.sh script:

# <called inside /etc/acpi/handler.sh:> xbacklight -steps 1 -inc 5%
RANDR Query Version returned error -1

So I thought the only remaining difference is that when it's called from the script maybe xbacklight doesn't know which display to use (although I only have one connected, the internal notebook display, so there is no choice..). When I call it manually it probably takes the terminal's display. (Just my guesses, what else difference could you think of?)
Soo I wanted to use the -display parameter of xbacklight to test this. I ran xrandr to find out the display name..

$ xrandr |grep connected
eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 293mm x 165mm
HDMI1 disconnected (normal left inverted right x axis y axis)

Yeah, the notebook screen is eDP1. But xbacklight will not accept this. Even if I run it manually, which worked before, will now with '-display eDP1' throw the same error that previously the call from handler.sh (without -display option) gave:

# xbacklight -display eDP1 -steps 1 -inc 5%
RANDR Query Version returned error -1

So it seems that the display name returned by xrandr is not the one that can actually be used with xbacklight.
Just for the record: I also tried -d 0 and -d 1 and -d eDP-1 and -d eDP-1-1 just randomly, all would fail.

How can I find out the display name that I can use with 'xbacklight -display' please?

Last edited by millus (2021-01-06 11:01:31)

Offline

#2 2021-01-06 11:22:57

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,230

Re: How to obtain display names used for xbacklight?

Don't use xbacklight. It's outdated and relies on a xf86-video-intel shim that in turn relies on xorg being present to then end up adjusting the actual kernel provided backlight. Cut out the middle man and just adjust the kernel provided backlight node. If you like the xbacklight syntax, acpilight provides a drop in replacement (make sure your user is in the video group if you intend to change with a normal user)

Last edited by V1del (2021-01-06 11:27:50)

Offline

#3 2021-01-06 12:02:00

millus
Member
Registered: 2019-07-21
Posts: 244

Re: How to obtain display names used for xbacklight?

Ohhh. I didn't know it was deprecated.
By kernel provided node do you mean echoing directly into the sysfs node? (on my pc /sys/class/backlight/intel_backlight/brightness)

Edit:
Ok, I made custom scripts (with calc -p lol) that echo into sysfs node brightness and put them into acpi handler.sh, works! smile
THanks!

Edit 2:
In case anyone else is running into difficulties with tools like xdotool etc when coding similar stuff.. I just found out that setting the DISPLAY is not enough! xdotool will not work from within a script for things like getwindowfocus getwindowname!
You need to specify the Xauthority too, then it will work. Eg..

DISPLAY=:0 XAUTHORITY=/home/you/.Xauthority xdotool getwindowfocus getwindowname

Last edited by millus (2021-01-07 01:08:04)

Offline

Board footer

Powered by FluxBB