[Interest] Detecting system power events

Marius Kittler mkittler at suse.de
Wed Sep 15 20:52:41 CEST 2021


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.

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.




More information about the Interest mailing list