Controlling brightness from the CLI

My idea is that it would be something similar to the post titled: (forgive me for I cannot post links!)

Is there a way to control KDE Plasma 6 night light from the command line?

The solution to which is:

I use /usr/bin/qdbus6 org.kde.kglobalaccel /component/kwin invokeShortcut "Toggle Night Color" in a script to toggle it on and off.

I am wondering what the command would be to control the brightness level using a command similar to the one above so it can be used in scripts and aliases.

Thanks in advance!

hi.
in my Fedora 40 works:
to check current value:

qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/BrightnessControl org.kde.Solid.PowerManagement.Actions.BrightnessControl.brightness

to set:

qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/BrightnessControl org.kde.Solid.PowerManagement.Actions.BrightnessControl.setBrightness $

$ - value to set

2 Likes

Hi talowicz

I made 10 scripts for my non-wayland system

#!/bin/sh
xrandr --output eDP-1 --brightness 1

Vektor

you might find ddccontrol -h to be useful.

Usage:
ddccontrol [-b datadir] [-v] [-c] [-d] [-f] [-s] [-r ctrl [-w value]] [-l (profile path)] [-p | dev]
        dev: device, e.g. dev:/dev/i2c-0
        -p : probe I2C devices to find monitor buses
        -c : query capability
        -d : query ctrls 0 - 255
        -r : query ctrl
        -w : value to write to ctrl
        -W : relatively change ctrl value (+/-)
        -f : force (avoid validity checks)
        -s : save settings
        -v : verbosity (specify more to increase)
        -b : ddccontrol-db directory (if other than /usr/share/ddccontrol-db)
        -l : load values from XML profile file


and from the documentation html

Change the brightness
The lines concerning brightness in the available controls list are:

      > id=brightness, name=Brightness, address=0x10, delay=-1ms, type=0
        supported, value=55, maximum=100
The important elements are address (here: 0x10), current value (55) and maximum value (100).

To change the brightness value to 70/100, type:

ddccontrol -p -r 0x10 -w 70
The last lines of the output should be:
Writing 0x10, 0x46(70)...
Control 0x10: +/70/100 [Brightness]
1 Like