client icon indicating copy to clipboard operation
client copied to clipboard

[Linux] [Ubuntu 16.04] No tray icon in Xenial

Open stephen-d-hill opened this issue 10 years ago • 63 comments

Expected behaviour

To see icon

Actual behaviour

No icon

Steps to reproduce

Install owncloud client

Client configuration

Client version: 2.1.1+dfsg-1ubuntu1

Operating system: Xubuntu 16.04

OS language: English UK

stephen-d-hill avatar Apr 17 '16 09:04 stephen-d-hill

What do you see instead? Can you run the client as owncloud --logfile - and paste the output? Which Qt version?

guruz avatar Apr 18 '16 07:04 guruz

The owncloud main window works fine, just no notification icon. I am unsure how to find out my QT version.

logfile - owncloud_logfile.txt

stephen-d-hill avatar Apr 18 '16 09:04 stephen-d-hill

Thanks, the logfile mentioned it.. Using Qt 5.5.1

Is there nothing before that in the log?

@ckamm @danimo maybe you know more about those tray issues..

guruz avatar Apr 18 '16 09:04 guruz

Used --logfile instead of --logwindow this time - owncloud_logfile1.txt

stephen-d-hill avatar Apr 18 '16 10:04 stephen-d-hill

Maybe this in Qt 5.6 helps..

commit f156c33c2739d84b97cdedf6ae9568b9cea728d5
Author: Dmitry Shachnev <[email protected]>
Date:   Fri Apr 1 21:28:00 2016 +0200

    dbustray: Implement better detection of indicator-application

    We need to do the icon cache trick all desktops using indicator-application,
    these are not limited to Unity. For example, the default Xubuntu and Lubuntu
    desktops use indicator-application too.

    Without this, tray icons will be improperly shown on these desktops.

    Change-Id: Id397bbe9b594152d7c3a29c36c853e928af7dde4
    Reviewed-by: Shawn Rutledge <[email protected]>

guruz avatar Apr 18 '16 14:04 guruz

Some more changes from that Qt branch.. FYI @ckamm

commit a4fac65938fdee74c07d34727920fb74087f82c6
Author: Dmitry Shachnev <[email protected]>
Date:   Sat Feb 6 14:42:39 2016 +0300

    dbustray: Support late registering of tray icon menu

    If a menu is added to the tray icon after the icon itself has been registered,
    we need to register the menu properly.

    Change-Id: I19a6d78848142d66c2cd882746d8d55c0b9a2818
    Reviewed-by: Błażej Szczygieł <[email protected]>
    Reviewed-by: Shawn Rutledge <[email protected]>

commit 7ad930987da7bb1d9aed17f25a1d99eeb5574a42
Author: Dmitry Shachnev <[email protected]>
Date:   Sat Feb 6 19:12:52 2016 +0300

    dbustray: Do not change m_menu in QDBusTrayIcon::createMenu()

    This method can be called for a submenu after it's called for the top-level
    menu, and we should not replace it with a submenu.

    Change-Id: I8e180ee074287cfcdc76dfe77c6c7aa7d5891741
    Reviewed-by: Błażej Szczygieł <[email protected]>
    Reviewed-by: Shawn Rutledge <[email protected]>

guruz avatar Apr 18 '16 14:04 guruz

Can I provide more info? I'm as well experiencing this bug.

scroom avatar Apr 22 '16 11:04 scroom

I now upgraded to 16.04 and the packages and I can confirm above findings. The workaround for now is to use the Ubuntu 15.10 packages provided by us. Those still are Qt4 based but solve the problem.

danimo avatar Apr 22 '16 14:04 danimo

I filed https://bugs.launchpad.net/ubuntu/+source/owncloud-client/+bug/1573639 with Ubuntu.

danimo avatar Apr 22 '16 14:04 danimo

This must be a special bug related to the way we rebuild the System tray. A trivial example works just fine.

#include <QApplication>
#include <QSystemTrayIcon>
#include <QImage>
#include <QPixmap>
#include <QMenu>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QImage img(64,64, QImage::Format_ARGB32);
    img.fill(Qt::red);
    QSystemTrayIcon sti(QIcon(QPixmap::fromImage(img)));
    QMenu *menu = new QMenu();
    menu->addAction("Foo");
    menu->addAction("Bar");
    menu->addSeparator();
    QMenu *submenu = new QMenu("Sub Menu");
    submenu->addAction("Bleh");
    menu->addMenu(submenu);
    menu->addSeparator();
    QObject::connect(menu->addAction("Quit"), SIGNAL(triggered(bool)), &a, SLOT(quit()));
    sti.setContextMenu(menu);
    sti.show();

    return a.exec();
}

danimo avatar Apr 22 '16 14:04 danimo

Expected behaviour

To see icon

Actual behaviour

No icon

Steps to reproduce

Install owncloud client

Client configuration

Client version: 2.1.1+dfsg-1ubuntu1

Operating system: ubuntu 16.04

OS language: Dutch

Mustangman1966 avatar Apr 24 '16 12:04 Mustangman1966

We know, please do not post any +1's. We are working on a solution to the problem.

danimo avatar Apr 24 '16 18:04 danimo

I was able to locate the problem. The problem is in ubuntu's "appmenu-qt5" and is a bug that cause our call to QSystemTrayIcon::isSystemTrayAvailable() to remove the icon.

That's because appmenu-qt5 seems to assume there is only one QPlatformSystemTrayIcon while there can be one per QSystemTrayIcon. in particular, QSystemTrayIcon::isSystemTrayAvailable creates a temporary one, and when it gets distroyed, it unregister the dbus object for the existing systray.

ogoffart avatar Apr 25 '16 14:04 ogoffart

FYI @mitya57

guruz avatar Apr 25 '16 14:04 guruz

Thanks @guruz for pointing me to this, and thanks to @ogoffart for narrowing down the problem.

Appmenu-qt5 is dead, and we want to remove it from Ubuntu as soon as our Qt is updated to 5.6 (which has native support for D-Bus trays and global menus). However, provided that 16.04 is an LTS release, it may make sense to get the appmenu-qt5 bug fixed there. I will add it to my list, however I have very few time, so I don't know when I will be able to get to it. Merge proposals against lp:appmenu-qt5 welcome, of course :)

mitya57 avatar Apr 25 '16 14:04 mitya57

@mitya57 thanks for the reply :) Then we need to workaround it from our side. XDG_CURRENT_DESKTOP should be Unity on 16.04?

guruz avatar Apr 25 '16 15:04 guruz

Yes

~>  echo $XDG_CURRENT_DESKTOP 
Unity

nazar-pc avatar Apr 25 '16 15:04 nazar-pc

$XDG_CURRENT_DESKTOP depends on environment, but it's not related to this bug.

For workaround on your side, try checking for $QT_QPA_PLATFORMTHEME and unsetting it if it's equal to appmenu-qt5 (before constructing the QGuiApplication).

mitya57 avatar Apr 25 '16 15:04 mitya57

I reported the bug to appmenu-qt5: https://bugs.launchpad.net/appmenu-qt5/+bug/1574699

ogoffart avatar Apr 25 '16 15:04 ogoffart

Also another way to workaround the problem is to run owncloud with --platformtheme=generic command line option

ogoffart avatar Apr 26 '16 10:04 ogoffart