[Gambas-user] systray does NOT work with gb-qt5 ubuntu 18.04

Benoît Minisini g4mba5 at gmail.com
Wed Jun 27 21:09:58 CEST 2018


Le 20/06/2018 à 18:36, herberth guzman a écrit :
> Hi Benoit
> 
> I tried the system tray in ubuntu 18.04 in 32bits and 64 bits
> 
> in 32 bits if it works, in ubuntu 64 bits it does not work.
> 
> If it works in 32 bits, do you think it can get to work in 64 bits ...?
> 
> 
> Regards
> 

I guess "I tried the system tray" means that you tried to display an 
icon in the systray bar with a Gambas program?

I'm using Ubuntu 18.04 64 bits, and it works perfectly with KDE, which 
use the DBus icon protocol, which, alas, is actually the DBus KDE icon 
protocol, as KDE, Gnome and Ubuntu are bad enough to not be able to 
agree on a standard Dbus Icon protocol!

So how does it work?

When you want to create a system tray icon, you have to use the 
'gb.gui.trayicon" component.

That component does the following:

1) It loads the 'gb.dbus' component.

2) It uses DBus to know if there is a DBus system tray running on your 
desktop.

3) If there is, then it loads the 'gb.dbus.trayicon' component, and uses 
it to implement the TrayIcon class. Beware that the component has to 
adapt to the current desktop, because they weren't able to agree to the 
same DBus protocol, as I said before!

4) Otherwise, it uses the old X11 system tray protocol implemented 
inside each GUI component; their Trayicon classes using the same 
interface so that it is transparent for you.

So:

You must first check if your desktop implements a DBus system tray. The 
test is the following:

Try DBus["org.kde.StatusNotifierWatcher"]["/StatusNotifierWatcher", 
"org.kde.StatusNotifierWatcher"].IsStatusNotifierHostRegistered

If the previous fails or returns FALSE, then we suppose that there is no 
DBus System tray.

In that case, you have to check if your desktop implements an X11 system 
tray. The old desktops usually only use it, the new one using the Dbus 
protocol (and sometimes a X11 backward-compatible system tray)

If you found a DBus system tray, then you have to check your desktop 
type, which is the contents of the XDG_CURRENT_DESKTOP environment variable.

If that variable is not KDE, then we assume that the Ubuntu DBus system 
tray protocol is used (aka "indicators"). Otherwise we assume the KDE 
system tray protocol. They are not compatible. (Again, big thumbs up for 
that!)

In all that mess, there is no distinction between 32 bits and 64 bits.

Try to retrieve all the previously described information so that we can 
guess what exactly happens on your system.

Regards,

-- 
Benoît Minisini


More information about the User mailing list