Recent

Author Topic: Yet Another TrayIcon issue  (Read 1582 times)

dbannon

  • Hero Member
  • *****
  • Posts: 2794
    • tomboy-ng, a rewrite of the classic Tomboy
Yet Another TrayIcon issue
« on: May 02, 2023, 05:05:56 am »
Posted under LCL because, while its a quite specific Linux issue, it needs to be avoided in all cross platform code that uses the TrayIcon.

We know that calling Show before assigning a menu to the TrayIcon results in a "no show". But, new in Gnome Desktop 44 the Gnome developers have found a new way to torment System Tray users. If the assigned menu contains no menu items at time of TrayIcon.Show, the Icon appears but will never show menu items subsequently assigned to it. This was not the case in, eg Gnome DT 43, nor in any other Linux desktop, now in any other OS that has a compatible System Tray.

The error message shown fortunately is clear about what the issue is. If you generate your menus dynamically, make sure there is at least one menu item in there before you call TrayIcon.Show.

Near as I can tell, the problem only shows up on Gnome 44, that means Ubuntu Luna (and, obviously only with a Gnome Desktop). The misspelt error message has been in libdbusmenu-glib for a long time, I guess the Gnome Developers only recently spotted it.

I have made a note about this on the TrayIcon wiki page.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Yet Another TrayIcon issue
« Reply #1 on: May 03, 2023, 06:20:56 pm »
Hello Davo.

Here on XUbuntu and Xfce I have no luck, even using your popup-menu-item trick.
I did test with TrayIcon widget from LCL-Gtk, MSEgui and fpGUI.

No icon show.  :'(

But the strange thing is that the same Trayicon-test-app compiled for Windows and running the application on Linux via the emulator wine, the icon appears!

So there is a trick that wine understood and maybe we have to check in his code for us.

Fre;D
« Last Edit: May 03, 2023, 06:38:44 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

dbannon

  • Hero Member
  • *****
  • Posts: 2794
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Yet Another TrayIcon issue
« Reply #2 on: May 04, 2023, 02:09:20 am »
Oh, thats a worry Fred.  I have not checked XUbuntu in U23.04, XFCe is more popular in Debian so I test it there. But Debian does not have this particular problem ....

I'll run some tests later today if I get a chance.

> I did test with TrayIcon widget from LCL-Gtk, MSEgui and fpGUI.

Hmm, I guess its a typo, I assume you mean LCL-Gtk2 ?  I don't test fpGUI and, sorry, I don't test MSEgui even though I know its near to your heart. I test GTK2 and Qt5 on Linux, both were affected by the Gnome 44 bug and both were 'fixable' on Gnome itself. I'd expect GTK3 to be the same and probably Qt6

But I will try my normal tests on XFCe  asap !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 2794
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Yet Another TrayIcon issue
« Reply #3 on: May 04, 2023, 12:52:25 pm »
No Fred, I lie, I did in fact test Ubuntu XFCe 23.04.

And it works perfectly with both LCL-GTK2 and LCL-Qt5.

Do you want to send me your test project please ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Yet Another TrayIcon issue
« Reply #4 on: May 04, 2023, 01:40:22 pm »
No Fred, I lie, I did in fact test Ubuntu XFCe 23.04.

And it works perfectly with both LCL-GTK2 and LCL-Qt5.

Do you want to send me your test project please ?

Davo

Hello Davo.

In attachment a LCL-GTK2 project, compiled with fpc 3.2.2. on Lazarus 2.2.4., that gives no icon on the traybar of my system XUbuntu 22.10 + XFCe.

Compiled-binary: https://github.com/fredvs/attach/files/11397514/project1_bin.zip

Fre;D

[EDIT] In picture-attachment, same project compiled for Windows and run on Linux via wine emulator:
The icon is shown !
« Last Edit: May 04, 2023, 02:48:49 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

dbannon

  • Hero Member
  • *****
  • Posts: 2794
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Yet Another TrayIcon issue
« Reply #5 on: May 05, 2023, 12:47:02 am »
Ah, I assumed you meant U23.04.  I don't do much testing on the short release versions of Ubuntu, they are around for such a short time and Ubuntu's own figures seem to indicate most Ubuntu users use the LTS ones. Further, I find the short release ones are not usually quite as stable as the LTS.

It was just luck I picked up the new problem in 23.04.

So, 22.10 ? Only has a few weeks of official support left.  I'll pull down an image and see what I can find.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Yet Another TrayIcon issue
« Reply #6 on: May 05, 2023, 01:18:56 am »
Ah, I assumed you meant U23.04.  I don't do much testing on the short release versions of Ubuntu, they are around for such a short time and Ubuntu's own figures seem to indicate most Ubuntu users use the LTS ones. Further, I find the short release ones are not usually quite as stable as the LTS.

It was just luck I picked up the new problem in 23.04.

So, 22.10 ? Only has a few weeks of official support left.  I'll pull down an image and see what I can find.

Davo

It is the XUbuntu version: https://xubuntu.org/
Without the "Unity" manager.
Indeed, there is just a new release 23.04, I did not yet the upgrade.
But I did have same trayicon problems on previous release of XUbuntu +  XFCe, not only 22.10.

It is the reason why I do not use TrayIcon anymore in Linux/FreeBSD system.
But, like said in previous post, there is something that wine does ok for dealing with X11-tray that I would be happy to understand. 

I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Yet Another TrayIcon issue
« Reply #7 on: May 05, 2023, 02:07:04 am »
Hello Davo.

OK, upgrade done:

Code: Bash  [Select][+][-]
  1. ~> lsb_release -a
  2. No LSB modules are available.
  3. Distributor ID: Ubuntu
  4. Description:    Ubuntu 23.04
  5. Release:        23.04
  6. Codename:       lunar
  7.  

Now testing the TrayIcon test (see attachment in previous post):

No, there is no icon in the Traybar.  :-\

[EDIT] And there is no more sound now (white night sure  :-X ).
            Ok, sound fixed (but still no icon in traybar).
« Last Edit: May 05, 2023, 02:33:18 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

rca

  • Jr. Member
  • **
  • Posts: 67
Re: Yet Another TrayIcon issue
« Reply #8 on: May 05, 2023, 02:52:54 am »
@Fred vS

I downloaded their Compiled-binary: https://github.com/fredvs/attach/files/11397514/project1_bin.zip

I ran it with Xubuntu Live 22.10 into USB. And it works correctly, it shows the icon and the PopupMenu. Attached image.

I also tested it on Fedora 38 with Gnome 44 and it works, just the icon looks smaller. Attached image.

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Yet Another TrayIcon issue
« Reply #9 on: May 05, 2023, 03:15:23 am »
@Fred vS

I downloaded their Compiled-binary: https://github.com/fredvs/attach/files/11397514/project1_bin.zip

I ran it with Xubuntu Live 22.10 into USB. And it works correctly, it shows the icon and the PopupMenu. Attached image.

I also tested it on Fedora 38 with Gnome 44 and it works, just the icon looks smaller. Attached image.

Hello Rca.
Nice that it works for you.  ;D

So I am lost, I dont see what is wrong on my side.  :-[

Do you have Xfce panel and window manager installed (see picture) ?

I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

rca

  • Jr. Member
  • **
  • Posts: 67
Re: Yet Another TrayIcon issue
« Reply #10 on: May 05, 2023, 03:36:58 am »
Hello @Fred vS

Yes, I have the Xfce panel and window manager installed. Attached images


Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Yet Another TrayIcon issue
« Reply #11 on: May 05, 2023, 03:48:38 am »
Hello Rca.

Yep, I get it!  ;D

But only with sudo privilege (see picture).
Strange that I need root privilege to see the icon.

Anyway, thanks for your test, so here it works with sudo ( but I am not sure that I will use TrayIcon again  :-X )

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

rca

  • Jr. Member
  • **
  • Posts: 67
Re: Yet Another TrayIcon issue
« Reply #12 on: May 05, 2023, 03:55:26 am »
Hello Rca.
...

Anyway, thanks for your test, so here it works with sudo ( but I am not sure that I will use TrayIcon again  :-X )

Fre;D

Hello @Fred vS

With great pleasure. I'm glad you got it to work.

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Yet Another TrayIcon issue
« Reply #13 on: May 05, 2023, 04:52:17 am »
OK, I get the solution.
From here: https://gitlab.xfce.org/xfce/xfce4-panel/-/issues/599#note_63222

The guilty: ayatana-indicator-application, it makes conflict with the Xfce indicator.
Just disable it in Settings/Session and Startup > Application Autostart

Now the icon appears, even without sudo  ;)

(Hard fight)
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

dbannon

  • Hero Member
  • *****
  • Posts: 2794
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Yet Another TrayIcon issue
« Reply #14 on: May 05, 2023, 07:13:58 am »
Ah, thats an interesting one Fred.

You should not need libayatana on XFCe, its only necessary, as I understand it, on a Gnome Desktop (along with some Gnome extensions). Are you running a multidesktop system ?  Where you select the Desktop as you login ?

I suspect you could have made it work if you started your app lile this -
Code: Pascal  [Select][+][-]
  1. LAZUSEAPPIND=NO ./project1 [enter]

Be interesting to know.  I don't have that code in the GTK3 version, only the GTK2 version of TrayIcon incidentally. And Qtx does not know about it either.

I do have a couple of "dual boot" (desktop only) VM I use for testing and have not seen any conflicts previously. I have libayatana installed on my Mate system and never had any problems. But I do remember that XFCe did announce they were developing their own SystemTray model a few years ago, along with a programme to eliminate all GTK2 code from XFCe.

Right now, the TrayIcon code 'prefers' libayatana if it finds it, that appears to be OK everywhere I test but now I need to start testing for combinations !  In my own app, I determine if the user is using Gnome and then look for libayatana and the gnome extension and warn them to install or activate the extension if necessary. Thats not necessary on Ubuntu Gnome but is necessary on all the other non-Ubuntu Gnome using systems.

Gnome puts a lot of effort into making things hard for us.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018