rncbc / qjackctl

QjackCtl - JACK Audio Connection Kit Qt GUI Interface
https://qjackctl.sourceforge.io
GNU General Public License v2.0
182 stars 40 forks source link

Feature request: new option to inhibit power management features while Jack is running #186

Closed gouttegd closed 1 year ago

gouttegd commented 1 year ago

It would be nice if QjackCtl could prevent power management features to kick in (e.g., the screensaver starting, or the computer going into any kind of “sleep mode”) as long as Jack is running.

When I’m using Jack, it happens quite often that my hands stay solely on my MIDI controllers, away from my keyboard and mouse, for quite a while – long enough for my desktop environment to think I’m inactive (MIDI input is apparently not considered as a form of “activity”…).

I thought I could use a startup script to inhibit power management features when starting Jack:

dbus-command --system --type=method_call --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Inhibit "idle" "QjackCtl" "Doing some music here" "block"

but this cannot work as the Inhibitor API is designed in such a way that an inhibitor lock is automatically released as soon as the process that requested the lock terminates (so here, it is released immediately after having been acquired, when the dbus-command terminates).

The lock would thus need to be acquired by a process that runs for at least as long as Jack and Jack clients are running, and I think QjackCtl is the most appropriate candidate.

Is there an interest for such a feature? I already have a rough patch that works, I can polish it and turn it into a PR.

rncbc commented 1 year ago

sorry, qjackctl may not be appropriate place to this very specific business (to systemd)...

my best suggestion is about wrapping the qjackctl command altogether with the systemd-inhibit tool.

gouttegd commented 1 year ago

To clarify, what I propose is not systemd-specific (though the API was apparently initially devised by systemd folks). I use the patch I was mentioning on a Slackware distribution that does not have systemd, but which does provide an implementation of the Inhibitor API.

But fair enough, using a wrapper that inhibits power management and then starts QjackCtl is good enough for me, even if I have to make my own wrapper (as Slackware does not provide the systemd-inhibit tool).

You may close here.