Why use polling when you can use interrupts? There is an idlehint bool in org.freedesktop.login1.session at /org/freedesktop/login1/session/auto and you can get notified when it changes by subscribing to the corresponding PropertiesChanged dbus signal.
It would be much more elegant than the current implementation that polls actively every second.
And it would also get rid of the X11 dependency.
It should be noted though that idlehint is not properly set right now in KDE Plasma: https://bugs.kde.org/show_bug.cgi?id=448942
But that should not be a showstopper, I might fix this bug in KDE over the weekend.
Why use polling when you can use interrupts? There is an
idlehintbool inorg.freedesktop.login1.sessionat/org/freedesktop/login1/session/autoand you can get notified when it changes by subscribing to the correspondingPropertiesChangeddbus signal.It would be much more elegant than the current implementation that polls actively every second.
And it would also get rid of the X11 dependency.
It should be noted though that
idlehintis not properly set right now in KDE Plasma: https://bugs.kde.org/show_bug.cgi?id=448942But that should not be a showstopper, I might fix this bug in KDE over the weekend.