[Interest] Detecting system power events

Kevin André hyperquantum at gmail.com
Fri Sep 17 22:37:50 CEST 2021


Hi,

Op wo 15 sep. 2021 om 20:53 schreef Marius Kittler <mkittler at suse.de>:
>
> I'm not aware of a cross-platform way. On a systemd-based system you can
> easily use its D-Bus interface via Qt DBus: https://www.freedesktop.org/
> software/systemd/man/org.freedesktop.login1.html#Signals
>
> You can check https://github.com/Martchus/syncthingtray/blob/master/connector/
> syncthingservice.cpp for an example.

Thanks.
But I am reluctant to write platform-specific code. I can only
realistically write code for the platform(s) that I use myself,
because that code needs to be tested by me first. However, I guess I
will have no choice, as expecting a cross-platform solution to
suddenly appear is not realistic :-)

> However, I'd also be interested in a cross-platform solution or at least some
> implementations of this for further platforms within the context of a Qt
> application. Under Windows it is likely just some WinAPI function but I
> haven't taken the time to look into it.

I have created a feature request for a cross-platform solution in Qt:
QTBUG-96637


More information about the Interest mailing list