owncloud / client

🖥️ Desktop Syncing Client for ownCloud
GNU General Public License v2.0
1.4k stars 666 forks source link

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

Closed stephen-d-hill closed 8 years ago

stephen-d-hill commented 8 years ago

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

guruz commented 8 years ago

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

stephen-d-hill commented 8 years ago

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

logfile - owncloud_logfile.txt

guruz commented 8 years ago

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..

stephen-d-hill commented 8 years ago

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

guruz commented 8 years ago

Maybe this in Qt 5.6 helps..

commit f156c33c2739d84b97cdedf6ae9568b9cea728d5
Author: Dmitry Shachnev <mitya57@gmail.com>
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 <shawn.rutledge@theqtcompany.com>
guruz commented 8 years ago

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

commit a4fac65938fdee74c07d34727920fb74087f82c6
Author: Dmitry Shachnev <mitya57@gmail.com>
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ł <spaz16@wp.pl>
    Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>

commit 7ad930987da7bb1d9aed17f25a1d99eeb5574a42
Author: Dmitry Shachnev <mitya57@gmail.com>
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ł <spaz16@wp.pl>
    Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
scroom commented 8 years ago

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

danimo commented 8 years ago

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 commented 8 years ago

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

danimo commented 8 years ago

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();
}
Mustangman1966 commented 8 years ago

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

danimo commented 8 years ago

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

ogoffart commented 8 years ago

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.

guruz commented 8 years ago

FYI @mitya57

mitya57 commented 8 years ago

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 :)

guruz commented 8 years ago

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

nazar-pc commented 8 years ago

Yes

~>  echo $XDG_CURRENT_DESKTOP 
Unity
mitya57 commented 8 years ago

$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).

ogoffart commented 8 years ago

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

ogoffart commented 8 years ago

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

dragotin commented 8 years ago

Ok, I think we can live with the workaround mentioned by @ogoffart and document that very prominentely.

We should continue to work with Ubuntu to help them fixing that as good as we can, @ogoffart already created the bug report.

@jnweiger could we add a start script that calls owncloud with parameter --platformtheme=generic with affordable effort to the package?

rhersel commented 8 years ago

@ogoffart This workaround does not work for me: --platformtheme is an unknown option for /usr/bin/owncloud on Ubuntu 16.04 with owncloud-client installed from Gnome-Software.

ogoffart commented 8 years ago

@rhersel works fine here with the owncloud client installed from whatever apt-get install owncloud does. If --platformtheme is an unkown option that might mean that owncloud was compiled with Qt4 instead of Qt5?

ogoffart commented 8 years ago

Workaround pull request for 2.2: https://github.com/owncloud/client/pull/4747

ogoffart commented 8 years ago

I tested the qt4 version on ubuntu, and it works well.

stephen-d-hill commented 8 years ago

Performing

sudo apt-get remove appmenu-qt5

works for me :)

On 27 April 2016 at 17:30, Olivier Goffart notifications@github.com wrote:

I tested the qt4 version on ubuntu, and it works well.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/owncloud/client/issues/4693#issuecomment-215139835

step4wd commented 8 years ago

Running owncloud --platformtheme=generic gives the following output:

Unrecognized option '--platformtheme=generic'
Try 'owncloud --help' for more information

I tried sudo apt-get remove appmenu-qt5 also but didn't help.

ogoffart commented 8 years ago

@step4wd then you are using the Qt4 version. The Qt4 version works for me. What is your problem exactly? Which owncloud package are you using?

step4wd commented 8 years ago

@ogoffart I installed owncloud-client which comes with Ubuntu 16.04 as it is.

oserban commented 8 years ago

The default owncloud client on Ubuntu Xenial (as returned by owncloud --version) is: ownCloud version 2.1.1 Using Qt 5.5.1

s-light commented 8 years ago

for me its the same:

stefan@stefan-latitude:~$ owncloud --platformtheme=generic
Unrecognized option '--platformtheme=generic'
Try 'owncloud --help' for more information
stefan@stefan-latitude:~$ owncloud --version
ownCloud version 2.1.1
Using Qt 5.5.1
stefan@stefan-latitude:~$ owncloud --help
ownCloud version 2.1.1
File synchronisation desktop utility.

Options:
  -h --help            : show this help screen.
  --logwindow          : open a window to show log output.
  --logfile <filename> : write log output to file <filename>.
  --logdir <name>      : write each sync log output in a new file
                         in folder <name>.
  --logexpire <hours>  : removes logs older than <hours> hours.
                         (to be used with --logdir)
  --logflush           : flush the log file after every write.
  --confdir <dirname>  : Use the given configuration folder.

For more information, see http://www.owncloud.org

my system is an Kubuntu 16.04 64bit

jmfrappier commented 8 years ago

Same thing as @oserban and @step4wd with version and error launching owncloud --platformtheme=generic Just launching owncloud still works as i sometimes get a notification that some files have been copied.

Steve-3d commented 8 years ago

I got the error with the unsupported command line option, too - but doing export QT_QPA_PLATFORMTHEME=generic before starting owncloud as usual works now and I get the icon back.

step4wd commented 8 years ago

@Steve-3d it worked for me. Now how to make owncloud always launch this way on startup? This is changing an environment variable which assume will effect other apps also.

Steve-3d commented 8 years ago

I created a little script for this:

#!/bin/bash  
QT_QPA_PLATFORMTHEME=generic  
/usr/bin/owncloud

This sets the variable only for the current shell process and does not modify anything else. Then I did a chmod +x ownCloudScript.sh and added it with full absolute path into the start programs tool to let it always run on login. I hope this helps :)

rhersel commented 8 years ago

The above script works perfectly for me. Thank you

frederikbosch commented 8 years ago

And modify your startup file.

sudo nano /usr/bin/owncloud-tray-fix
sudo chmod +x /usr/bin/owncloud-tray-fix
nano ~/.config/autostart/owncloud.desktop

Modify the Exec line as foloows.

Exec=owncloud-tray-fix
VNovotna commented 8 years ago

Running owncloud like this env QT_QPA_PLATFORMTHEME=generic owncloud is even easier.

didubu-fr commented 8 years ago

Hello, They solved the problem at Ubuntu, a new package was released in Yakkety and Xenial proposed : https://bugs.launchpad.net/ubuntu/+source/owncloud-client/+bug/1573639/comments/11 Thanks !

geez0x1 commented 8 years ago

Has anybody tested this on Debian 8 (stable/jessie)? I just installed client 2.2.0 and the icon has disappeared.

nazar-pc commented 8 years ago

Funny, but it just appeared with 2.2.0 update on Ubuntu:)

etamme commented 8 years ago

I am not sure ... but this may have broken the system tray icon for my 14.04 installation. Here is a gist of my apt-history for the day:

https://gist.github.com/etamme/9e547c536b44f7a3f2b0998b8765bd94

Basically now the systray icon is in the very top left of my screen and appears "on top" of any window.

nazar-pc commented 8 years ago

There was such bug some long time ago, like 1.5 years or so.

etamme commented 8 years ago

So yea I saw that when I was searching, but this morning my systray icon was fine, but after I installed the updates in the linked gist, the owncloud systray icon got messed up.

Niyes commented 8 years ago

In Debian 8 (Jessie) missing tray icon after update to the 2.2.0 version :(

cmburg commented 8 years ago

Same in elementary OS 0.3 (64bit) (32 bit not tested yet but had not problems at all IIRC)

DroWnThePoor commented 8 years ago

I'm having this problem as well.No tray icon at all since last 2 updates. I have another machine running the client before the updates and it works perfectly. I was wondering what exactly I'd need to do to transfer that version of the client from one Ubuntu install to another? Can anyone advise me?

tony5 commented 8 years ago

@DroWnThePoor

It has already been acknowledged that there is a bug and a work around has been posted.

Ubuntu 16.04 / client Version 2.2.0%nil (build 1605) Using Qt 5.5.1 = no tray icon with gnome desktop.

The client still works without the tray icon but if you need it then the commands posted above will work.

You can adjust the program startup or manually run the bellow command in a terminal.

~$ killall owncloud && nohup env QT_QPA_PLATFORMTHEME=generic owncloud >/dev/null &

mitya57 commented 8 years ago

I have created a proper fix for this bug in appmenu-qt5. While I'm waiting for a review I have uploaded the package with this fix to my PPA so that you can test it.

Commands to get the package from my PPA are:

sudo add-apt-repository ppa:mitya57/ppa
sudo apt-get update
sudo apt-get install appmenu-qt5

Please test and give your feedback.

tony5 commented 8 years ago

@mitya57 did not work for me, maybe I did it wrong. I did not add the ppa but installed appmenu-qt5_0.3.0+16.04.20151130-0ubuntu1+ppa1_amd64.deb from your link removing appmenu-qt5 all together will work or adjust start up ~$ killall owncloud && nohup env QT_QPA_PLATFORMTHEME=generic owncloud >/dev/null &

I also have no idea why the issue is marked closed?