Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open notes from tray feature not working on LxQt #216

Open
chriswyatt opened this issue Apr 28, 2020 · 27 comments
Open

Open notes from tray feature not working on LxQt #216

chriswyatt opened this issue Apr 28, 2020 · 27 comments

Comments

@chriswyatt
Copy link

chriswyatt commented Apr 28, 2020

I previously made the feature request #209 (and I was very grateful for the feature being accepted so quickly). I had been using the same revision from this branch for quite a while, but I just built 1.2.1 from master. I went into settings and enabled Open notes from tray. I can see the notebooks in the tray, but clicking them has no effect. Also, it's no longer possible to access the individual notes from the tray menu (i.e., with fold out menus), but this is perhaps by design?

image

QT versions: qt5-base 5.14.2 and qt5-tools 5.14.2
OS: Arch Linux
Desktop environment: LXQt 0.15.0

@hakaishi
Copy link
Owner

We do not suffer from this bug.
Notebooks unfold and are clickable.
Just to avoid any doubts: Could you please make a fresh git clone and build it from there?

BTW: What is your Qt version, OS and desktop environment?

@nebomuk
Copy link
Collaborator

nebomuk commented Apr 28, 2020

Thank you for testing the new feature. Please check out the latest revision of the master branch. The latest commit has the tag v1.2.1, not v1.2.0

@chriswyatt
Copy link
Author

chriswyatt commented May 1, 2020

Sorry. I had built v1.2.1. I've corrected the typo in my description.

QT versions: qt5-base 5.14.2 and qt5-tools 5.14.2
OS: Arch Linux
Desktop environment: LXQt 0.15.0

@chriswyatt
Copy link
Author

I've tried moving my ~/nobleNote and ~/.config/nobleNote directories, and launching the app (to create a fresh config and notes), but this does not help. If I find time this weekend, I'll see if I can figure out how to debug it myself.

@hakaishi
Copy link
Owner

hakaishi commented May 8, 2020

Could you please try if the new branch "1.3_pre-release" would work for you?
If not, then it will be a compatibility problem between your Qt and LXQt.

@chriswyatt
Copy link
Author

Sorry for my delay testing the new branch. It slipped my mind. I've tested again, and I'm still having the same issue.

@nebomuk
Copy link
Collaborator

nebomuk commented May 20, 2020

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

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QSystemTrayIcon trayIcon;


    QImage img(32,32,QImage::Format_ARGB32_Premultiplied);
    img.fill(Qt::green);
    QIcon icon(QPixmap::fromImage(img));
    trayIcon.setIcon(icon);
    trayIcon.setVisible(true);

    QMenu menu;
    menu.addAction("action1");
    auto sub = menu.addMenu("notebook2");
    sub->addAction("note1");
    sub->addAction("note2");

    trayIcon.setContextMenu(&menu);

    return a.exec();
}

Is it possible that your desktop environment does not show any sub-menus for tray icons? Can you try to build the snipped above via qmake -project, qmake, make and check if the sub-menus are displayed.

@chriswyatt
Copy link
Author

The code snippet works

@nebomuk
Copy link
Collaborator

nebomuk commented May 26, 2020

After lots of trial and error I came to the conclusion that LxQt does not support dynamically changing the tray menu. I even found LxQt specific workarounds for the issue with the missing "fold out menus". But even if I disable and destroy the tray icon and the menu and re-create it, the menu stays the same. New menu items never appear until the app is restartet.

I could not reproduce this issue on any other platform like macOS, Windows or other Linux desktop environments like Gnome or XFCE.

@chriswyatt
Copy link
Author

I thought LXQt borrowed the status notifier from KDE, though I could be wrong about it. I seem to remember reading it borrowed a few things from KDE when I was reading about it a while back.

So it's possible this same issue may exist in KDE, too.

@nebomuk
Copy link
Collaborator

nebomuk commented May 27, 2020

No, KDE does not suffer from this issue. On KDE, the open notes from tray feature works without any issues.

@chriswyatt
Copy link
Author

chriswyatt commented May 27, 2020

If you like, I can open a ticket on LXQt's bug tracker (referencing this ticket). This will probably affect Lubuntu too, as this tool is bundled (and it's where I discovered it), although of course, they won't have this new release for quite some time.

They may say it's not their problem, if it's not mandated in some sort of specification. However, if they see that it works on most other desktop environments, they may deem it worthwhile.

@nebomuk nebomuk changed the title Open notes from tray feature not working Open notes from tray feature not working on LxQt May 31, 2020
@nebomuk
Copy link
Collaborator

nebomuk commented May 31, 2020

Yes, please open a bug ticket. This issue probably affects more apps that try to dynamically change the tray menu.

@chriswyatt
Copy link
Author

Tsujan, one of the LXQt developers, can't see any obvious problems his end:
lxqt/lxqt-panel#1417 (comment)

I'm in the unfortunate position of being the messenger! Could you check my issue description and make sure I explained the problem properly.

@hakaishi
Copy link
Owner

hakaishi commented Jun 2, 2020

@chriswyatt
You really shouldn't apologise. That guy didn't even try to understand the problem.
It's true there is no "folding out" property.
But that's not the point. It's called submenu.

Also, there is no problem creating the menu, only problems when updating the menu. Once updated all menus turn into unresponsive items.
In other words: The submenus vanish. And we can't recreate them. Not even deleting the whole tray icon and recreating it will work. Nothing.
In Qt terms:
Recreating the QSystemTrayIcon will permanently destroy the QMenu's submenus. They become unreachable since the menus do not fold out anymore.
Recreating the QMenu leads to the same behavior.
Using the QMenu::clear() method and re-adding the QActions also leads to this behavior.

I will test this on Lubuntu, but my guess is that it's a problem with Arch Linux.

@chriswyatt
Copy link
Author

chriswyatt commented Jun 2, 2020

OK, I'll leave the other ticket alone in the meantime, until we are sure it's not specific to the combination of Arch, LXQt and nobleNote, or even any mistakes during compilation.

I was using vague terms, as I really don't know what they're called in the Qt world. I know next to nothing about Qt.

Since I tested this last, there was an update to liblxqt, so it would be worth me trying to compile again, just in case this was some unfortunate chance event of LXQt 0.15 being very new, and packages not being synchronised.

I could test in more DEs, but, I'd need to get a virtual machine set up, as I want to try and keep my current one pristine. It's time consuming too. I hope this doesn't block any releases, because it's still quite usable even with this issue, plus it seems to only be affecting LXQt.

@hakaishi
Copy link
Owner

hakaishi commented Jun 3, 2020

It's not specific to NobleNote. We tested a handful of snippets all failing.
I just tested this on Lubuntu. It's also failing there. I only tested on the live-disk-image, so I can't say if this problem might be resolved by some updates... (NobleNote build from source)

@chriswyatt
Copy link
Author

OK, interesting. On the other ticket, they are asking if someone could provide a small example app that triggers the problem:

lxqt/lxqt-panel#1417 (comment)

@hakaishi
Copy link
Owner

hakaishi commented Jun 6, 2020

Oh yes. Now I've got an error message on Lubuntu that might help to bring some light into this.
I do not know if this might be related too:

Icon theme "elementary" not found.

And here the error:

uint DBusMenuExporterDBus::GetLayout(int, int, const QStringList&, DBusMenuLayoutItem&): Condition failed: menu

The problem described in the comments above are occurring using the attached snippet. I only get the mentioned error with this snippet though.
qttest.tar.gz

  1. extract the snippet
  2. qmake
  3. make
  4. execute qttest

if qmake or make fails, try installing the following packages:
sudo apt-get install build-essential qtbase5-dev qttools5-dev-tools

@chriswyatt
Copy link
Author

chriswyatt commented Jun 10, 2020

I just re-tested with latest version of NobleNote (pre-release branch) and an up-to-date Arch, after I noticed a lot of Qt dependencies being updated. The issue still persists. I also thought it would be good to re-test, as there was a version mismatch with a package last time I compiled (i.e. LXQt 0.14 and 0.15 packages co-existing).

@tsujan
Copy link

tsujan commented Jun 11, 2020

@hakaishi
After playing with libdbusmenu-qt5's code for a few minutes, I really think the bug is in libdbusmenu-qt5: it won't see a submenu if it's inserted by connecting to QMenu::aboutToShow.

@hakaishi
Copy link
Owner

@tsujan
Thanks for the insight. Thought it strange that a dbus error was showing. Well, it doesn't appear in NobleNote though...
But I think that the possibility of a problem with DBus is great. After all it is THE interface to commute with the system, desktop manager etc etc.
I don't think that this feature is a "must have", it's more a "nice to have" for NobleNote. But as other applications might depend on this, I do hope that the problem will be resolved in the near future.

Best regards,

Hakaishi

@tsujan
Copy link

tsujan commented Jun 14, 2020

@hakaishi
For some reason unknown to me, QEvent::ActionAdded isn't received for submenu actions by libdbusmenu-qtdbusmenu_p.cppDBusMenu::eventFilter if the submenu is created inside the slot that is connected to QMenu::aboutToShow. I'm sure about that.

I think you could work around this problem by adding the needed submenu(s) before QMenu::aboutToShow is sent. Sadly, I haven't found time to read your code, being busy with several projects.

@hakaishi
Copy link
Owner

That's exactly the problem, I presume.
We want to update the menu upon opening it, but that's only working in aboutToShow.
If there is another way, please tell me.
Any way, the only environment where this is a problem is an environment using LxQT... Well, as far as tested until now.

@tsujan
Copy link

tsujan commented Jun 15, 2020

the only environment where this is a problem is an environment using LxQT

LXQt's status notifier depends on libdbusmenu-qt (which isn't developed by LXQt), while KDE may have ts own dbus menu. Perhaps, libdbusmenu-qt was derived from KDE's code at some point -- I don't know its history.

@hakaishi
Copy link
Owner

So, at least we know now where the problem lies.
It's neither nobleNote nor LxQT...

@tsujan
Copy link

tsujan commented Jun 16, 2020

It's neither nobleNote nor LxQT...

That's correct.

If only I could pinpoint the cause... That might require a detailed comparison between KDE codes and those of libdbusmenu-qt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants