On 7/23/24 1:46 AM, Andrei Borzenkov wrote:
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.
Yes! That was so damn simple and eliminates the sudo/su user issue completely, e.g. int displayBacklight::set_backlight ( int b ) { char buf[256] = ""; qWarning ("setting backlight: %d", b); sprintf (buf, "busctl call org.freedesktop.login1 " "/org/freedesktop/login1/session/auto " "org.freedesktop.login1.Session SetBrightness " "\"ssu\" \"backlight\" \"acpi_video0\" %d", b); return system (buf); } Works like a champ for the user. spinbox ValueChanged signal calls the set_backlight slot and a simple mousewheel scroll to set the nvidia backlight. Now to make systray the parent main window and have it display on mouseover and close on focus-out. Thank you for pointing me to this. I wouldn't have found it in a month of Sundays otherwise. -- David C. Rankin, J.D.,P.E.