Comments (7)
Unfortunately, the functionalty that Gtk.Application.inhibit
provides is different from what Haguichi needs. Haguichi does not start any operation that should not be interrupted. It merely listens for a PrepareForSleep() signal and then says "Hold on, let me quickly disconnect the Hamachi client before going to sleep..." in order to close the connection cleanly. And later on, when waking up, the connection is restored again. See the code at: https://github.com/ztefn/haguichi/blob/master/src/inhibitor.vala
Still, I'd love to hear if you know any other Gtk api that does provide this functionality.
from haguichi.
Thanks for clarifying that! I don't know about that off the top of my head, but I'll ask around :)
from haguichi.
It looks like LibPortal might be the route to go here. It seems like it has methods here to watch the session state: https://github.com/flatpak/libportal/blob/master/libportal/inhibit.c#L655
Or you could manually use the inhibit portal over dbus as described here: https://docs.flatpak.org/en/latest/portal-api-reference.html#gdbus-org.freedesktop.portal.Inhibit
And that should let you drop the login dbus interface
from haguichi.
Relevant issue in xdg-desktop-portal: flatpak/xdg-desktop-portal#137
from haguichi.
Specific dbus interface to watch session state changes:
https://docs.flatpak.org/en/latest/portal-api-reference.html#gdbus-signal-org-freedesktop-portal-Inhibit.StateChanged
The StateChanged signal is sent to active monitoring sessions when the session state changes.
When the session state changes to 'Query End', clients with active monitoring sessions are expected to respond by calling QueryEndResponse() within a second of receiving the StateChanged signal. They may call Inhibit() first to inhibit logout, to prevent the session from proceeding to the Ending state.
Implementation in libportal appears to be Portal.session_monitor_start
When the state changes, the Portal:session-state-changed signal is emitted.
public signal void session_state_changed (bool screensaver_active, LoginSessionState session_state)
Emitted when session state monitoring is enabled and the state of the login session changes or the screensaver is activated or deactivated.
The values of this enum are returned in the Portal::session-state-changed signal to indicate the current state of the user session.
Enum values:
ENDING - the session is about to end
QUERY_END - the session is in the query end phase, during which applications can save their state or inhibit the session from ending
RUNNING - the session is running
from haguichi.
Implementation in GTK 3 (same in GTK 4, but documentation for prior version is more readable):
https://valadoc.org/gtk+-3.0/Gtk.Application.query_end.html
[ Version ( since = "3.24.8" ) ]
public signal void query_end ()Emitted when the session manager is about to end the session, only if GtkApplication::register-session is true.
Applications can connect to this signal and call inhibit with gtk_application_inhibit_logout to delay the end of the session until state has been saved.
from haguichi.
Last few days I have tested both Gtk and LibPortal methods and it turned out inhibitors get totally ignored when the system is suspended by the user.
Also there are no QUERY_END or ENDING signals being sent when the system is suspended. Only logout and shutdown events seem to trigger those signals.
So unless the issue Inhibit portal and PrepareForSleep signal #137 in xdg-desktop-portal gets any traction I'm afraid we're stuck with using the org.freedesktop.login1
dbus interface, just like 50 other applications currently on flathub.
Please reopen or create a new issue when there is a proper replacement.
from haguichi.
Related Issues (20)
- Haguichi seems to corrupt Hamachi on Ubuntu 20.04 HOT 6
- libappindicator3-1 package does not exist in Debian testing HOT 5
- issues account and constant Dc HOT 3
- Authentication is needed to run systemctl as superuser HOT 1
- Package as Flatpak for elementary OS 6 HOT 5
- AppCenter colors are low-contrast HOT 2
- Consider using GLib.Notification or send desktop entry hint with Notify HOT 2
- "Authentication is needed to run '/usr/bin/systemctl' as the super user" HOT 5
- Haguichi asking for authentication HOT 1
- Cant configure HOT 2
- Not working, not installing HOT 4
- Misspelled function: `aquire`
- Getting a "Hamachi version 2.1.0.203 is obsolete" message on start. HOT 15
- Provide a label for alias name HOT 9
- Gets disconnected HOT 1
- How to resolve the blue dot issue? HOT 1
- ZeroTier HOT 1
- Reconnecting again and again HOT 2
- Ubuntu 24.04 LTS (Noble Numbat) Support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haguichi.