Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid polling every second #2

Open
vimpostor opened this issue May 15, 2023 · 3 comments
Open

Avoid polling every second #2

vimpostor opened this issue May 15, 2023 · 3 comments

Comments

@vimpostor
Copy link

vimpostor commented May 15, 2023

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.

@perk11
Copy link
Owner

perk11 commented May 15, 2023

Does Gnome currently set this? I found it was not doing it in 2019 https://mail.gnome.org/archives/desktop-devel-list/2019-May/msg00088.html

If yes, this would indeed be a good alternative. I think it will make sense to add support to use multiple detection methods and let the user pick which one to use.

Also I don't see polling every second as a big problem, that shouldn't be using a lot of CPU, but removing dependency on X11 would be a good thing.

@vimpostor
Copy link
Author

vimpostor commented May 15, 2023

Does Gnome currently set this? I found it was not doing it in 2019 https://mail.gnome.org/archives/desktop-devel-list/2019-May/msg00088.html

I don't use Gnome, so can't test the current state of this unfortunately.

Also I don't see polling every second as a big problem, that shouldn't be using a lot of CPU

Yes it's not a big problem.
Nonetheless, getting rid of the polling completely would be nice to have.

@perk11
Copy link
Owner

perk11 commented May 15, 2023

It just seems like neither Gnome nor KDE support this currently :) So then this implementation would not benefit anyone until this is fixed upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants