Il 05/01/2024 21:47, Valerio Vanni ha scritto:
Il 05/01/2024 21:24, Valerio Vanni ha scritto:
For what I've seen, the issue is that kaffeine is started in another
unit, systemd-suspend.service instead of user@1000.service.
systemd-suspend.service is deactivated after 90 seconds from resume,
and kaffeine is shut down some msec before.
If I use "su" method instead of "setpriv" one, kaffeine doesn't go into
systemd-suspend.service unit, and neither to user@1000.service one.
Instead, it goes to session-c2.scope. And works.
And systemd-suspend.service is finished and deactivated at the moment of
resume.
It seems that systemd-suspend.service wants to end as soon as possible,
but it cannot because it has kaffeine inside.
So it waits 90 seconds, and then terminates kaffeine.
This way works, I don't know if it has security flaws.
------------
systemd-run --unit=kaffeine-resumed setpriv --reuid "$kafuid" --regid
"$kafgid" --init-groups --reset-env \
env XDG_RUNTIME_DIR=/run/user/"$kafuid" $kafdis
XDG_CURRENT_DESKTOP=KDE \
/usr/bin/kaffeine --lastchannel > /dev/null 2>&1
------------
All is launched from systemd-run. I choosed kaffeine-resumed as unit
name, but if you don't put any a casual name one is created.
So systemd-suspend.service unit is free and can close.