Skip to content

Pure-dbus system tray (drop PySide6/Qt) + Plugin Manager Order-tab fixes#5

Open
GaimsDevSoftware wants to merge 6 commits into
mainfrom
feature/tray-dbus
Open

Pure-dbus system tray (drop PySide6/Qt) + Plugin Manager Order-tab fixes#5
GaimsDevSoftware wants to merge 6 commits into
mainfrom
feature/tray-dbus

Conversation

@GaimsDevSoftware

Copy link
Copy Markdown
Owner

Replaces the PySide6/Qt tray with a pure dbus-python StatusNotifierItem (tray_dbus.py, left-click menu via ItemIsMenu=true), drops the PySide6 Flatpak dependency, adds Pin-to-top for popup plugins, and fixes Plugin Manager Order-tab drag-and-drop / right-click reordering plus a plugin-reload thread leak that froze tray Settings/Plugins.

Note: overlaps feature/icons-and-seo on the Order-tab reordering work — reconcile on merge.

load_all() re-imports each plugin as a fresh module but never tore down
the previous module's background threads. clipboard_history starts a
clipboard watcher + snippet-trigger watcher at register time, so every
reload (one fires on each settings save) leaked another pair. The trigger
watcher reads input devices in a tight loop, so a few leaked copies
saturated the GIL, froze the GTK main loop, and stopped the tray command
socket from being serviced -- Settings and Plugins menu items silently
stopped responding.

Add a generic unregister() teardown hook: plugin_loader tracks loaded
user modules and calls each module's optional unregister() before
re-importing. clipboard_history.unregister() stops both watchers.
…nu=true)

Qt's QSystemTrayIcon hardcodes the SNI ItemIsMenu property to false and
offers no API to change it, so on KDE Wayland left-click could not surface
the menu: plasmashell sent Activate() instead of showing the menu, and a
client-side QMenu.popup() never maps on Wayland. Right-click worked only
because plasmashell renders the DBusMenu itself.

Replace the Qt tray subprocess with a hand-rolled StatusNotifierItem +
com.canonical.dbusmenu implemented in dbus-python (already bundled for
KGlobalAccel), advertising ItemIsMenu=true. plasmashell then renders our
menu on both left- and right-click. Icon is rasterised with GdkPixbuf
(IconPixmap for the light/dark styles, IconName for colour); the
length-prefixed JSON socket protocol to the daemon is unchanged. tray.py
prefers tray_dbus.py and falls back to tray_qt.py if absent.

Verified live: ItemIsMenu=true on the running item, full menu served via
GetLayout, and a synthetic DBusMenu clicked event on "Settings…" reached
the daemon ("opening settings dialog…").
…rder tab

Both reorder gestures were no-ops on GTK3/Handy:
- The drag source was set on the whole HdyActionRow, but the enclosing
  GtkListBox claims the button-1 press for row activation, so the drag
  never started. Move the drag source to the drag handle (the gripin
  its own GtkEventBox), which reliably begins the drag; the row stays the
  drop target.
- Right-click used a GestureMultiPress on each row, which the listbox can
  swallow. Replace it with a single button-press-event handler on the
  parent GtkListBox, resolving the target row via get_row_at_y() - the
  canonical, reliable pattern.
The drag handle started the drag but dropping never moved the plugin: the
payload was written with set_text()/read with get_text(), which only work
for text targets. With the custom LINUXPOP_ORDER_ROW atom, get_text()
returned None, int() raised, and the drop was silently ignored. Use
SelectionData.set()/get_data() with the target atom instead.
New pinned_plugins setting. Pinned plugins always sort before everything
else, in pin order, and can't be pushed below by reordering the rest -
applied consistently in the popup (for_content_type + the matched-view
sort) and the Order tab. Right-click in the Order tab gains Pin to top /
Unpin from top; pinned rows show a star.
The system tray no longer uses QSystemTrayIcon - tray_dbus.py is a
hand-rolled StatusNotifierItem on dbus-python + GdkPixbuf, both already
available in the sandbox. Remove the PySide6-Essentials + shiboken6 bundle
(>100 MB) from the manifest, delete the now-dead tray_qt.py, and drop the
Qt fallback in tray.py.

Validated by running tray_dbus.py inside the installed Flatpak sandbox:
it registers with org.kde.StatusNotifierWatcher through the D-Bus proxy,
serves ItemIsMenu=true, renders the icon via GdkPixbuf, and serves the
full DBusMenu.
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

Successfully merging this pull request may close these issues.

1 participant