On 06/01/2024 19:44, Valerio Vanni wrote:
systemd-run --unit=kaffeine-resumed --uid="$kafuid" --gid="$kafgid" \
env XDG_RUNTIME_DIR=/run/user/"$kafuid" $kafdis
XDG_CURRENT_DESKTOP=KDE \
/usr/bin/kaffeine --lastchannel > /dev/null 2>&1
I have not figured out how to do it, but systemd-run should not use
--uid since this way it makes the application a part of system.slice.
Instead the application should be in app.slice that is a child of
user@1000.service. Inspect output of systemd-cgls.
So systemd-run should talk to the systemd --user instance. I have tried
to set
XDG_RUNTIME_DIR="/run/user/1000"
BUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
in setpriv ... env, but systemd requires authentication.
It seems neither su nor sudo add process to the user context (proper
cgroup, XDG session), so attempts to talk to the systemd user session
through D-Bus fail.
I tried command from a ssh session root@... Behavior may be different
from suspend/resume tasks since the session is associated with a pty.