linuxmint / xapp

Cross-desktop libraries and common resources
GNU Lesser General Public License v3.0
126 stars 44 forks source link

The status icon is missing on Gnome on Ubuntu #137

Open DarthGandalf opened 3 years ago

DarthGandalf commented 3 years ago

Ubuntu 21.04, standard installation libxapp1 2.0.7-1

XApp.StatusIcon.get_state() returns no-support, and the tray icon never appears. But tray works with AppIndicator.Indicator which however misses the feature I need - ability to receive the activate signal.

The readme says this library should work across all Gtk desktop environments, is it true only for Mint?

Here's the code:

Glib::Object::Introspection->setup(
    basename => 'XApp',
    version  => '1.0',
    package  => 'XApp',
);

my $tray = XApp::StatusIcon->new;
$tray->set_icon_name('shutter-panel');
$tray->set_secondary_menu($tray_menu);
$tray->signal_connect('activate', sub { ... });
$tray->set_visible(1);
Glib::Timeout->add(5000, sub {
    say $tray->get_state;
    return FALSE;
});

But it works with Plasma, in the fallback mode.

Ref https://github.com/shutter-project/shutter/issues/331

mtwebster commented 3 years ago

There's a new standard is StatusNotifier (https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/). AppIndicator is compatible (more or less) with this standard, though as you noted, it lacks activate.

XAppStatusIcon implements its own native interface to communicate with an XAppStatusIconMonitor (the display portion of this), and will fall back to GtkStatusIcon, which is not available under wayland. So unless someone adds support for XAppStatusIcon to gnome (highly unlikely for various reasons), you're out of luck.

QSystemTrayIcon (which I assume plasma uses?) has two modes - it implements StatusNotifierItem if it detects its availability, and will use its own equivalent of GtkStatusIcon if not.

The reason the xapp icon is working in plasma fallback is because plasma apparently still supports xembed (GtkStatusIcon).

To achieve what you're after, we'll have to implement StatusNotifierItem support in XAppStatusIcon. I'll see about doing this in the near future, it wouldn't be too difficult.

DarthGandalf commented 3 years ago

I see, thanks!