tray-icon icon indicating copy to clipboard operation
tray-icon copied to clipboard

Replace libappindicator with ksni

Open dfaust opened this issue 1 year ago • 11 comments

Using ksni and the xdg standard for tray icons on Linux unlocks missing functionality and new features (https://github.com/tauri-apps/tray-icon/issues/104 and more), as well as unblocks a GTK4 migration (https://github.com/tauri-apps/webkit2gtk-rs/issues/94).

  • Predefined menu items are not handled, except separator and about.
  • Shortcuts are ignored.

Companion PR for muda: Export more internals so muda can be used in combination with ksni: https://github.com/tauri-apps/muda/pull/239

Tauri issue: [feat] Use ksni crate for tray icons on Linux: https://github.com/tauri-apps/tauri/issues/11293

dfaust avatar Nov 01 '24 13:11 dfaust

@amrbashir @FabianLars How do we proceed from here? The tests fail because the PR depends on https://github.com/tauri-apps/muda/pull/239.

dfaust avatar Dec 31 '24 13:12 dfaust

you can make tray-icon depend on the git version of muda for now

FabianLars avatar Dec 31 '24 13:12 FabianLars

Sorry for the delay, been a bit busy IRL, and also not sure if we want to have this in tauri v2, keep old implementation and add it in tauri v2 behind a feature flag or wait for v3

amrbashir avatar Dec 31 '24 15:12 amrbashir

if we make v3 only about switching from gtk3 to gtk4 (which imo we should) this change could wait for v3. If v3 takes ages i think it would be better to add it in v2 if that's not too much of a headache. I wouldn't put it behind a feature flag either way unless there's something missing compared to the libappindicator implementation that i don't see rn.

FabianLars avatar Dec 31 '24 15:12 FabianLars

Alright. Then please keep me updated. And I updated the muda dependency.

dfaust avatar Dec 31 '24 16:12 dfaust

I am actually leaning towards keeping the old implementation for now and adding this behind experimental feature flag (ksni) for both, tray-icon crate and tauri crate

amrbashir avatar Dec 31 '24 22:12 amrbashir

I put the ksni stuff behind a feature flag linux-ksni (I also renamed the muda feature).

I also created a new PR for tauri (https://github.com/tauri-apps/tauri/pull/12319).

And it seems the compiler has become more strict. I'm still fixing the windows issues. The macos issue I don't understand, though.

dfaust avatar Jan 08 '25 21:01 dfaust

the macos issue should be fixed by https://github.com/tauri-apps/tray-icon/pull/220

FabianLars avatar Jan 21 '25 13:01 FabianLars

I rebased the PR, but now the about dialog crashes:

cargo run --example tao -F linux-ksni

(tao:1924160): Gtk-CRITICAL **: 14:46:21.228: gtk_text_attributes_ref: assertion 'values != NULL' failed

(tao:1924160): Gtk-CRITICAL **: 14:46:21.228: gtk_text_attributes_ref: assertion 'values != NULL' failed

(tao:1924160): Pango-CRITICAL **: 14:46:21.228: pango_layout_new: assertion 'context != NULL' failed
Speicherzugriffsfehler (Speicherabzug geschrieben)

dfaust avatar Feb 08 '25 14:02 dfaust

Is there anything preventing this issue from being merged? I'm happy to help but I don't know what still needs to be done.

samvv avatar Jun 02 '25 13:06 samvv

That is a very interesting PR, any plans to finish it?

ancwrd1 avatar Nov 05 '25 21:11 ancwrd1