Results 1 to 5 of 5

Thread: QSystemTrayIcon and linux...

  1. #1
    Join Date
    Aug 2012
    Location
    Loughborough, UK
    Posts
    29
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: QSystemTrayIcon and linux...

    Hi all,

    I've recently converted our application to run in linux. It's a big application and mostly 'it just works' and if not i've been able to tweak it. The only fly in the ointment that's left is the QSystemTrayIcon which works on some linux desktops and not others.

    It works on:
    KUbuntu and other KDE distros fine.

    It half works on Ubuntu 13.04 unity ( it appears as an icon on the desktop instead but this at least makes the application functional )

    It doesnt work on Mint 15 MATE or Cinammon, ubuntu 13.04 with Gnome...

    Has anybody managed to make a tray icon appear with any of these distros? I'm using Qt5.1.1 on an x64 oracle VM to test all these systems...

    Thanks in advance,

    Richard.


    Added after 1:


    Just discovered that on ubuntu 13.04 with gnome if you click activities there's a blank icon next to the removable devices icon. This when clicked shows our context menu. So it would appear at least partially broken in this scenario? You'd expect it to appear in the task bar which is normally across the top of the screen or am I missing something, but i'd have found it if the icon actually existed?

    Still no progress on the other installs as yet...

    Thanks,

    Rich
    Last edited by rockdemon; 4th October 2013 at 10:17.

  2. #2
    Join Date
    Aug 2012
    Location
    Loughborough, UK
    Posts
    29
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: QSystemTrayIcon and linux...

    Debian with gnome seems to also be missing the tray icons...

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSystemTrayIcon and linux...

    Quote Originally Posted by rockdemon View Post
    Debian with gnome seems to also be missing the tray icons...
    If that is also with GNOME 3, or rather with GNOME Shell as the workspace shell, then the different distribution doesnt matter.

    Basically the issue is this:
    QSystemTrayIcon on X11 systems is using a technique call XEmbed to embed its icon into the system tray area of the currently active workspace shell.
    This has been the primary means for system tray icons so there is nothing conceptually wrong with that.
    However, XEmbed is a rather clunky thing, making it hard or even impossible for workspace shells to handle them nicely, e.g. hide unneeded/unwanted ones.

    Anyway, whether or not a QSystemTrayIcon shows up depends on whether the workspace shell has support for XEmbed based tray icons. As you have discovered that is true for KDE's Plasma Workspace and, in a slightly different visualization, for the Unity Desktop Shell.

    GNOME Shell based workspaces, such as GNOME3 and CINNAMON, might not either not handle those at all or require an applet or extension to be added to the normal shell configuration. You could check with respective user forums or developer lists.

    GNOME Panel based workspaces, such as GNOME2 or MATE, should also be more like KDE or Unity in this regard.

    QSystemTrayIcon is currently still a class that does its platform dependent things internally, i.e. has code for Windows, X11, etc. It is quite likely that it will be ported to use the new QPA (Qt Platform Abstraction) facilities at some point, which would allow it to use the native tray integration of the running workspace shell instead of falling back to the rather crude XEmbed mechanism.

    Just for anyone interested in more details:
    KDE Plasma Workspaces and Unity Desktop share a new integration technology called system notifiers (in Unity those appear where you had expected tray icons). It is based on D-Bus, so it can be used through QtDBus, and the KDE Frameworks 5 initiative will most likely have a nice Qt style API available in one of its integration frameworks.

    Cheers,
    _

  4. The following user says thank you to anda_skoa for this useful post:

    rockdemon (4th October 2013)

  5. #4
    Join Date
    Aug 2012
    Location
    Loughborough, UK
    Posts
    29
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: QSystemTrayIcon and linux...

    Many thanks for the detailed answer. Knowing what to look for i'll go and look up XEmbed in more detail!


    Cheers,

    Rich

  6. #5
    Join Date
    Aug 2012
    Location
    Loughborough, UK
    Posts
    29
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: QSystemTrayIcon and linux... SOLVED

    For anybody that's interested, I've been able to create a window with an icon to cover linux desktops without system trays. The hardest part was detecting whether the tray icon is there or now. Best trick i found for the is looking at QSystemTrayIcon::geometry()::width() as on linux where it wasnt working the width is 0 or 1. Qt always says the system tray is there and claims the tray icon is visible whether it is or now...

    Hope that's some help to someone

    Rich
    Last edited by rockdemon; 8th October 2013 at 16:27. Reason: SOLVED

Similar Threads

  1. QSystemTrayIcon help
    By SkylineBob in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2010, 17:22
  2. Problem with QSystemTrayIcon on Mac OS
    By mourad in forum Qt Programming
    Replies: 1
    Last Post: 22nd May 2008, 10:53
  3. QSystemTrayIcon - how to make one?
    By slava in forum Qt Programming
    Replies: 4
    Last Post: 9th March 2008, 11:00
  4. QSystemTrayIcon does not scale on X11
    By bleucanard in forum Qt Programming
    Replies: 0
    Last Post: 3rd March 2008, 09:35
  5. problem when using QSystemTrayIcon
    By thrantir in forum Qt Programming
    Replies: 5
    Last Post: 23rd July 2007, 10:14

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.