Skip to content
New issue

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

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

Already on GitHub? # to your account

[experimental] status notifier infra #61

Merged
merged 7 commits into from
Sep 30, 2024
Merged

[experimental] status notifier infra #61

merged 7 commits into from
Sep 30, 2024

Conversation

ldelossa
Copy link
Owner

@ldelossa ldelossa commented Sep 22, 2024

This pull requests implements experiment StatusNotifier support (Tray Icons).

The implementation leans on GtkPopover to display menus.
This comes with some opinions on how menu should be displayed in Gtk4.
Mostly:

  1. No icons in menus
  2. No tooltips on menu items
  3. No stateful buttons (radio buttons, check boxes, etc...).

It is possible to circumvent these, err limitations?, with a custom widget, but the MVP of this feature doesn't do this.

The DBusMenu API is parsed into a GMenuModel. AFAIKT there's not many libraries which do this, and its hand-rolled, so please draw my attention to apps which cause an issue.

Current limitations:

  1. When a DBusMenu is updated, we destroy the old layout and add the new one, this means you'll get Menu flickers/closes. This can be improved in a subsequent patch.
  2. There maybe some instability, can't promise there won't be crashes

image

- Add the necessary DBUS services for org.kde.StatusNotifier
- Send signals for dbus session name creation/removal
- CRUD on org.kde.StatusNotifierItem via aforementioned Dbus signals and
  notifier infra
- new IndicatorBar to list SNI buttons in the panel
This commit adds the necessary functions for an initially useable
DBUSMENU.

It's not the best implementation, for instance, we just completely
replace menu models when an update for the Menu comes up. This works
decently well tho, at least for nm-applet which I'm testing with.

Signed-off-by: ldelossa <louis.delos@gmail.com>
After some experimentation:
-  Crashes can be avoided when swapping out a newly updated GMenuModel
   into the GtkPopoverMenu by using the correct API (who would have
   guessed).

Signed-off-by: ldelossa <louis.delos@gmail.com>
Signed-off-by: ldelossa <louis.delos@gmail.com>
Signed-off-by: ldelossa <louis.delos@gmail.com>
The StatusNotifierItem DBus signals seem to be detached from actually
updating the cooresponding proxy's values.

It therefore became necessary to init the StatusNotifierItem with values
gained from the proxy attributes, but then perform a GetAll properties
call on the proxy when we receive a signal from the StatusNotifierItem
interface.

This commit handles this two-truths scenario, where we first init from
cached proxy attributes, then query DBus on signals

Signed-off-by: ldelossa <louis.delos@gmail.com>
@ldelossa ldelossa changed the title wip: status notifier infra [experimental] status notifier infra Sep 30, 2024
@ldelossa ldelossa merged commit 704ac4e into main Sep 30, 2024
@ldelossa ldelossa deleted the status-notifier branch September 30, 2024 22:57
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant