Subject: Re: bug#63620: 30.0.50; [Feature Request] run hooks on sleep/wake

From: Andrew Cohen <[email-masked]>
Date: Fri, 07 Feb 2025 16:20:14 +0800

>>>>> "MA" == Michael Albinus <[email-masked]> writes:

    MA> Andrew Cohen <[email-masked]> writes: Hi Andrew,

    >> (systemd allows me to list all of the applications holding
    >> blocks. My gnome desktop typically shows 7 or 8 applications
    >> holding blocks for sleep, including the Network Manager, Power
    >> Manager, etc)

    MA> Side note: According to org.freedesktop.login1.Manager, you
    MA> could get this information also on D-Bus level, calling method
    MA> ListInhibitors.

Yes, thanks. I was just using this for testing to see if I was
understanding the logic.

    MA> Another idea: There are the properties Docked, LidClosed and
    MA> OnExternalPower. Perhaps you could check them in your
    MA> sleep-handler, and start different actions depending on their
    MA> value.

That is a good idea. We could generalize the mode to handle a variety of
things other than sleep. Maybe we should use a new event category
(<system-event> or something) rather than sleep-event. This general
event can contain actions for sleep, docked, lidclosed, etc. And we
provide a mode for system-event, with sleep just one of the actions. For
D-Bus, this becomes pretty trivial---we just inject all the events we
are interested into system-event and have an appropriate handler.

I must say, I hadn't fully appreciated all that can be done with
D-Bus.

Best,
Andy

-- 
Andrew Cohen