[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Change suspend type from kde menu



On 06/01/2024 22:19, Max Nikulin wrote:
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

Instead the application should be in app.slice that is a child of user@1000.service. Inspect output of systemd-cgls.

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.

setpriv --reuid 1000 --regid 1000 --init-groups --reset-env -- \
   env XDG_RUNTIME_DIR="/run/user/1000" \
   systemd-run --user --slice=app.slice -- \
   xterm

I have realized that earlier I forgot to add --user to systemd-run. To my surprise, it does not work if I set BUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" instead of XDG_RUNTIME_DIR. I expected that the former is required for systemd-run.

This command works from a root shell prompt, I hope it should work during resume as well.


Reply to: