Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

There is this old thread of mine: How do I create a working indicator with Qt/C++? where I was suggested to use the QSystemTray library for making a tray icon in Ubuntu for my application.

Sniqt is a program that takes care of the rest. As known, Ubuntu has got rid of tray icons. Instead, it now uses indicators and only indicators. Sniqt converts the Qt tray icons into working indicators.

The problem is that it doesn't do a very decent convertion. Actions like single click, middle click etc do not work, while they do in systems that support tray icons.

Is there a way to have these actions back? Can I use QSystemTray icon and still have these interesting (and very helpful, in my occasion) actions in Ubuntu?

I would be glad to know the answer to the other thread I talked about earlier (how to make a working indicator using the GTK libraries and prevent the crash), as well.

Link for Sniqt bug: https://bugs.launchpad.net/sni-qt/+bug/1027652

share|improve this question
    
Isn't this normal behaviour for all indicators? They only accept left-click and scroll events. –  Timo Dec 4 '12 at 11:12
    
Nope! If you e.g. middle click the sound icon, it will mute/unmute the sound. In my application, I want to make it quit. –  hakermania Dec 4 '12 at 12:46
    
@mateo_salta, please compare it with askubuntu.com/questions/158323/… –  hakermania Dec 13 '12 at 12:11

2 Answers 2

up vote 0 down vote accepted

It seems that Qt does not support this thing, at least on Ubuntu Unity, even if it has a signal 'activated'. So I would recommend you to use GTK and a normal trayicon, I see no alternative with Qt. You may contact the developers of Qt for clarification on this.

share|improve this answer
1  
Sorry but Qt indeed has this functionality at its tray icons. My tray's action work flawlessly in other systems. It is Ubuntu's problem and its stubbornness with the indicators. Sniqt may be able to solve the issue –  hakermania Dec 9 '12 at 21:47
2  
I can confirm that this is not Qt's fault. I also doubt the problem lies with sniqt. I'm not aware that application indicators even have the capability to differentiate between left and right clicks. This has been a constant source of frustration for me as well. –  Nathan Osman Dec 13 '12 at 2:26

Unity, by choice, doesn't support what you are referring to as "decent tray icons". It's indicators or nothing. From there you have several options:

  • Make do with the limited indicator capabilities. You can set the menu that will by used by your indicator with the standard QSystemTray.setContextMenu() method.

  • Detach your app from the systray entirely. As in, turn it into a floating icon on the desktop, that will be able to accept middle- and right-clicks as God and Matthias Ettrich intended. You can find a simple example of how to do this here: http://kde-apps.org/content/show.php/KEyes?content=51493 (Optionally, do this only when you detect that you are running under Unity, i.e. if $DESKTOP_SESSION is set to 'ubuntu'.)

  • Declare Unity unsupported. This is not a very good option.

Whether you'll want to go with option 1 or 2 mainly depends on what your application does.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.