On Tue, Jul 23, 2024 at 9:13 AM David C. Rankin <drankinatty@gmail.com> wrote:
All,
I wrote a small Qt app to adjust the display backlight on my laptop:
https://paste.opensuse.org/pastes/a67b89db433f
It will be a systray app like kmix. As part of the program I write to /sys/class/backlight/ACPI_video0/brightness which is owned by root with 0644 permissions.
I have a bash script that does it, but simply using sudo is enough, but how to do the same thing in Qt?
Just use systemd-logind D-Bus API, like ``` busctl call org.freedesktop.login1 /org/freedesktop/login1/session/auto org.freedesktop.login1.Session SetBrightness "ssu" "backlight" "amdgpu_bl0" 4711 ``` or appropriate bindings for the language you are using. See https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.logi... for details.