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

Re: Change suspend type from kde menu



On 11/01/2024 02:32, Valerio Vanni wrote:
Il 08/01/2024 04:29, Max Nikulin ha scritto:
On 07/01/2024 12:44, Max Nikulin wrote:

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

Instead of tricks with setting proper context for a process executed system-wide, I would consider a process running in user sessions and listening for D-Bus events:

So your idea would be stopping and starting channel play by dbus messages?
I'm looking again with introspect, and I don't see anything like "stop" in kaffeine.

It is independent ideas:
- Do not deal with user processes in system context (like /usr/lib/systemd/system-sleep/ scripts)
- Try to release dvb tuner device, so module can be unloaded.

I believe, it is a bug in the cx23885 module that it can not handle suspend/resume (and probably hibernate/thaw).

The following is related to avoiding "setpriv" in system context and listening for D-Bus events in user session scope:

$ dbus-monitor --system "type='signal',interface='org.freedesktop.login1.Manager',member='PrepareForSleep'"

suspend:

signal time=1704679441.870349 sender=:1.6 -> destination=(null destination) serial=3187 path=/org/freedesktop/login1; interface=org.freedesktop.login1.Manager; member=PrepareForSleep----------------------------------------------------^^^^^^^^^^^^^^^
    boolean true

resume:

signal time=1704679448.065409 sender=:1.6 -> destination=(null destination) serial=3233 path=/org/freedesktop/login1; interface=org.freedesktop.login1.Manager; member=PrepareForSleep
    boolean false
---------------^^^^^

A tiny python script may be more convenient than dbus-monitor and similar tools.

Killing and starting kaffeine in response to these signals may be a workaround if the application does not allow to release the device.

Not stopping playback and not releasing the device in response to the PrepareForSleep signal, from my point of view, is a bug in kaffeine. I have no idea if vlc (broken hardware acceleration in bookworm) or another application may be an alternative for you.

Stopping playback through D-Bus by a custom script might be performed either from PrepareForSleep D-Bus signal listener or from a system-sleep script. I will respond to another message.


Reply to: