Score:0

Brightness control "Up"/"Down" with xrandr (Ubuntu 22.04)

aw flag

I am happily using the "brightness" command to control my TV as my primary display right now. But since I am working in a somewhat dim environment I was wondering if there is a way to not just set two precise values to keyboard shortcuts, but instead a more general commands for brightness "Up" and "Down"?

In the manual of xrandr I couldn't find the desired command. Perhaps I am looking for it the wrong way.

Edit: Here is some new info after the inxi command:

Graphics: Device-1: NVIDIA GF108GLM [NVS 5200M] driver: nouveau v: kernel
Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: modesetting
unloaded: fbdev,vesa gpu: nouveau resolution: 1920x1080~60Hz
OpenGL: renderer: NVC1 v: 4.3 Mesa 22.0.5

This is what my terminal shows, just with less colours.
Perhaps I should add that the current solution is:
sudo xrandr --output HDMI-1 --brightness 0.7
and
sudo xrandr --output HDMI-1 --brightness 1
binded to global keyboard shortcuts.

(it's so nice to be able to organize the text just a little bit :D)

Edit.2

I am not sure why, as it happened many moons ago, but I am on the open source driver because I think I had some issues with the proprietary driver. Perhaps I will stay on my working setup now as I am already used to it. Thank you for your time even if we didn't come to a solution to this not-really-a-problem thing.

Score:0
zw flag

The "brightness" function is handles by the graphics drivers, not xrandr. Depending on your hardware, the brightness may be switched via the /sys/devices/platform/.. virtual file system.

To find the correct "switches" use the "find" command:

find /sys/devices/platform/ -type f | grep 'brightness'

To set a value somewhere in that tree you use:

echo OPTION | sudo tee /sys/devices/platform/some/component/mysystembrightness

where OPTION and the "some/component" path is hardware specific.

Edit

Your inxi reveals a NVIDIA graphics card with nouveau driver. Try to install the proprietary NVIDIA driver, which supports brightness control better.

After you installed the NVIDIA drivers do:

sudo gedit /usr/share/X11/xorg.conf.d/21-nvidia.conf

Paste the following into the file:

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    Option         "RegistryDwords" "EnableBrightnessControl=1"   
EndSection

Additionally add to your grub commandline: acpi_backlight=vendor

update_grub and reboot.

Martin Yankov avatar
aw flag
I can clearly see I am getting a lot of things wrong, but so far it's working for me. The "find" command brings me some of those lines: `/sys/devices/platform/i8042/serio0/input/input4/input4::capslock/brightness` `/sys/devices/platform/i8042/serio0/input/input4/input4::capslock/max_brightness`
Martin Yankov avatar
aw flag
_(meh, I can't even format this right)_
kanehekili avatar
zw flag
Not in comments. You did a pretty good, but adding it to your question would've been better, since no one wants to browse through the comments to get **all** information. But you seem to have no relevant brightness control there -this is all keyboard/led stuff. Could you execute `inxi -G`and paste the output into your question? (where you can format it)
kanehekili avatar
zw flag
See my updated answer. Report back if it worked
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.