-
Notifications
You must be signed in to change notification settings - Fork 15
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
Method using gtk_application_inhibit()? #404
Comments
About availability of gtk_application_inhibit()
|
Minimal working exampleHere is a minimal working example which uses the import time
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gio, Gtk
app = Gtk.Application(
application_id="io.readthedocs.wakepy",
flags=Gio.ApplicationFlags.IS_SERVICE | Gio.ApplicationFlags.NON_UNIQUE,
)
app.register()
app.inhibit(
None,
Gtk.ApplicationInhibitFlags(8), # prevent idle
"wakelock requested (wakepy)",
)
app.hold()
time.sleep(30)
app.release() unsolved
|
Running this in a separate processOne difficulty in using this within a virtual environment where |
Update: I have some sort of implementation which successfully inhibits idle (#407). It has two parts (1) server, which is intended to be started with the system python interpreter, like |
See: https://docs.gtk.org/gtk3/method.Application.inhibit.html
If I'm not mistaken, this requires PyGObject (which has import name
gi
) . It could be used as an alternative "no dbus" option?This is a particularly interesting option since so many Desktop Environments are based on the GTK graphical toolkit (GNOME, Xfce, Cinnamon, LXDE, MATE, Unity, Budgie, Pantheon), and because it offers a non-dbus alternative.
Alternatives
Make PyGObject (
gi
) a requirement for wakepy. This has the downside that (1) It's an additional dependency and (2) the PyGObject is not pure python package so it requires compiling tools to be available.Do site-packages search for system python folder and add theUse system python in separate process. I'm assuming thatgi
package into the sys.pathgi
python package is available in all the desktop environments which use GTK. No additional dependencies would be needed for wakepy. In other words, thegi
python package would be treated as any non-python dependency; you search, and if you find, you can use.Interfacing
gtk_application_inhibit()
directly withoutgi
somehow. Does not require dependency but probably requires a lot of extra work. I assume that if a system has GTK, it has alsogi
python package available so this kind extension module is not required.Tasks
gi
. Is it possible to prevent sleep and/or idle with it (to support both: keep.running and keep.presenting modes)? yes, it is.The text was updated successfully, but these errors were encountered: