pop-os / cosmic-settings-daemon

GNU General Public License v3.0
20 stars 16 forks source link

Config changes jammy #3

Closed wash2 closed 8 months ago

wash2 commented 9 months ago

Should resolve #2 but I need to implement the client for it and do some more testing.

ids1024 commented 8 months ago

Do any common DBus protocols use a timer+ping/pong mechanism like this? I think something involving NameOwnerChanged to detect when a client has disconnected might be more natural, though I'm not immediately able to think of examples using that for something similar either. Though with an appropriate time limit this method should work too.

I see this panic with

thread 'main' panicked at src/main.rs:484:18:
Failed to create notify watcher: Error { kind: Io(Os { code: 24, kind: Uncategorized, message: "Too many open files" }), paths: [] }

... until I kill the panel. But I guess that's expect and what this is meant to help with.

ids1024 commented 8 months ago

Yeah, looking in xdg-desktop-portal:

https://github.com/flatpak/xdg-desktop-portal/blob/66464504ad7210219f7a98511e0dfad4ae337d75/src/xdp-utils.c#L934-L975 has a helper for handling NameOwnerChanged to detect when the unique name of a client has changed (and the client has disconnected from dbus).

https://github.com/flatpak/xdg-desktop-portal/blob/66464504ad7210219f7a98511e0dfad4ae337d75/src/xdg-desktop-portal.c#L185-L191 uses the callback provided by that helper to close requests and sessions from clients that's have disconnected from the bus.

So NameOwnerChanged with unique names seems like the best way to detect if a client has disconnected. Without the client having to do anything special.

wash2 commented 8 months ago

Ok, I'll look into implementing it using NameOwnerChanged