pbek / QOwnNotes

QOwnNotes is a plain-text file notepad and todo-list manager with Markdown support and Nextcloud / ownCloud integration.
https://www.qownnotes.org/
GNU General Public License v2.0
4.67k stars 412 forks source link

Ubuntu gnome desktop file name #1019

Closed bios-ben closed 4 years ago

bios-ben commented 6 years ago

Expected behaviour

Add to favorites button works in ubuntu 18.

Actual behaviour

Add to favorites missing.

Steps to reproduce

Open app and right click in dock to see missing menu, try renaming solution and now it shows.

Version 18.09.01

After reading stack exchange I found that desktop links cannot be added to favorites unless their file name matches the window name. Checking into this it seems the file is named PBE.QOwnNotes.desktop and when renamed to QOwnNotes.desktop the problem is fixed, as per the above link. However, I did find #933 that caused this rename to happen in the first place. Is it possible to get the default desktop link named properly to work in ubuntu?

pbek commented 6 years ago

You have researched the problem pretty well. Unfortunately I have no secret information on how to make it work in both conditions, please let me know if you find anything out!

PaulVanSchayck commented 6 years ago

I also ran into this, and can confirm this temporary workaround:

sudo mv /usr/share/applications/PBE.QOwnNotes.desktop /usr/share/applications/QOwnNotes.desktop
pbek commented 6 years ago

That was the previous name, see #933. I will try adding StartupWMClass=QOwnNotes to the desktop file in the next release. Can you please try using the PBE.QOwnNotes.desktop and adding above line to it and report if that works.

PaulVanSchayck commented 6 years ago

Yup, this also seems to works! Thanks for that

pbek commented 6 years ago

awesome!

pbek commented 6 years ago

18.10.3

pbek commented 6 years ago

There now is a new release, could you please test it and report if it works for you?

OtharSmirnow commented 4 years ago

On Ubuntu it does not work as expected. obraz I will update if any of workarounds above works

pbek commented 4 years ago

On Ubuntu it does not work as expected. obraz I will update if any of workarounds above works

Where did you install QOwnNotes from? Can you please post the output from the debug settings (see issue template).

OtharSmirnow commented 4 years ago

Installed snap from Ubuntu Software: Channel: Stable Version: 19.12.13 Last Update: 18.12.2019 Developer: Patrizio Bekerle

QOwnNotes.log

pbek commented 4 years ago

I'm not sure how Gnome (or are you using Unity?) is handling desktop files from snaps. If you are using the stable channel this desktop file is used: https://github.com/pbek/QOwnNotes/blob/develop/snap/gui/PBE.QOwnNotes.desktop

pbek commented 4 years ago

Could you test the Ubuntu PPA, AppImage or Flatpack of QOwnNotes if you have the same problem? see https://www.qownnotes.org/installation

OtharSmirnow commented 4 years ago

I am running Ubuntu 19.10 with Gnome

Tested AppImage - same story.

I created a .desktop file with Arronax and it worked well(placed in /usr/share/applications), but I wasn't able to edit the one in snap. [Desktop Entry] Type=Application Icon=folder-copy Name=QOwnNotes-test Exec=qownnotes Terminal=false Hidden=false Categories=Office; Utility StartupWMClass=QOwnNotes Comment=test

may be unrelated: when starting from terminal I got this Warning: Qt: Session management error: None of the authentication protocols specified are supported ((null):0, (null)) Warning: propsReply "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.758\" (uid=1000 pid=12069 comm=\"/snap/qownnotes/4219/usr/bin/QOwnNotes -style=Fusi\" label=\"snap.qownnotes.qownnotes (enforce)\") interface=\"org.freedesktop.DBus.Properties\" member=\"GetAll\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.NetworkManager\" (uid=0 pid=1372 comm=\"/usr/sbin/NetworkManager --no-daemon \" label=\"unconfined\")" ((null):0, (null)) Warning: nmReply "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.758\" (uid=1000 pid=12069 comm=\"/snap/qownnotes/4219/usr/bin/QOwnNotes -style=Fusi\" label=\"snap.qownnotes.qownnotes (enforce)\") interface=\"org.freedesktop.NetworkManager\" member=\"GetDevices\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.NetworkManager\" (uid=0 pid=1372 comm=\"/usr/sbin/NetworkManager --no-daemon \" label=\"unconfined\")" ((null):0, (null)) Warning: "Object path cannot be empty" ((null):0, (null)) Warning: Unable to find dictionary for "pl_PL" in path "/pl_PL" ((null):0, (null)) Info: "Serwer QOwnNotes oczekuje na połączenia na porcie 22222" ((null):0, (null))

datumbox commented 4 years ago

Same problem on Gnome 3.36.3 while using the snap version (20.8.10). Could we reopen the ticket given that the problem persists?

pbek commented 4 years ago

Doesn't make a lot difference as long nobody knows how to fix it. 😁

datumbox commented 4 years ago

If there is anything I can do to help debug I'm more than happy to help. Let me know.

pbek commented 4 years ago

The only thing that comes to mind is to play with the desktop file or research how the favorites in Gnome work and why it has troubles detecting the application correctly. I don't have this issue under KDE.

datumbox commented 4 years ago

Here is an ugly workaround. If you rename the file qownnotes_PBE.QOwnNotes.desktop to qownnotes_qownnotes.desktop it works fine. This is located in /var/lib/snapd/desktop/applications/ and also in your ~/.local/share/applications/ if you have custom shortcuts. No other desktop file needs to be modified.

The way I found this was by observing the naming convention of the desktop files of all of my snaps. Any snap with desktop file not named like {snapname}_{snapname}.desktop has exactly the same problem (excluding the ubuntu snap store which I don't understand why it works).

@pbek Is the naming you are using valid? If yes, looks like an upstream problem as you hinted originally.

pbek commented 4 years ago

I guess snapcraft chose that name. The original file that is used is https://github.com/pbek/QOwnNotes/blob/develop/build-systems/snap/snapcraft/snap/gui/PBE.QOwnNotes.desktop

pbek commented 4 years ago

And as far as I know if the name is changed it invalidates all links to desktop files... 😬

datumbox commented 4 years ago

Do you have a snapcraft account to raise the question in their forums and see if there is a workaround or proposed solution? Skypeforlinux snap has exactly the same problem BTW so your app is definitely not the only one affected. If you don't let me know and I'll raise it for you.

pbek commented 4 years ago

I could, but I don't have a Gnome system around to test/confirm and I'm not sure what will happen with #933 if I rename the file again.

pbek commented 4 years ago

1713 seems similar, but also seems to be fixed

pbek commented 4 years ago

@datumbox, I tried to rename the desktop file in the edge channel (currently building) to qownnotes.desktop, hoping it will then have the correct name later on. Could you please try the edge snap?

datumbox commented 4 years ago

@pbek Did you push it to stable by accident? It seems that stable is newer than edge:

$ snap info qownnotes
.....
channels:
  latest/stable:    20.9.1  2020-09-01 (7379) 130MB -
  latest/candidate: ↑                               
  latest/beta:      ↑                               
  latest/edge:      20.8.10 2020-08-31 (7371) 127MB -

At any case, I tested the both the stable and edge but I don't see the file renamed. The desktop file in /var/lib/snapd/desktop/applications is still qownnotes_PBE.QOwnNotes.desktop in both versions. As a result when I open the app, I still see the same problem.

Happy to test further if you want.

pbek commented 4 years ago

Seems like the edge build didn't trigger on https://snapcraft.io/build. I triggered the build manually now...Should be done in maybe 25min.

OtharSmirnow commented 4 years ago

just changed channel to edge. it does work correctly now. Thank you :) When you change it in stable?

pbek commented 4 years ago

Ah, thank you.

When you change it in stable?

Next release.

datumbox commented 4 years ago

@pbek Yeap, works like a charm! Thanks for fixing it. :)

pbek commented 4 years ago

20.9.2

pbek commented 4 years ago

There now is a new release building (stable channel), could you please test it and report if it works for you?

datumbox commented 4 years ago

@pbek I installed the snap from latest/stable 20.9.2 2020-09-03 (7389).

Now I see two files stored in /var/lib/snapd/desktop/applications. One is named qownnotes_qownnotes.desktop and one qownnotes_PBE.QOwnNotes.desktop. This causes two duplicate icons of the app to appear on gnome applications dashboard.

Is having two desktop files intentional? Can we lose the qownnotes_PBE.QOwnNotes.desktop?

pbek commented 4 years ago

Maybe that desktop file was there before and wasn't removed by the snap update, there should only be one. I only renamed the file, like for the edge channel. What happens if you uninstall QOwnNotes? Is there still that desktop file? If yes, can you please remove it and install QOwnNotes again.

datumbox commented 4 years ago

No the file is being installed from scratch; it's not a left over from an earlier installation. Here is what I see:

I'm using the stable channel this time. Perhaps one of the other install scripts is triggered and installs both files?

Happy to investigate more.

pbek commented 4 years ago

Perhaps one of the other install scripts is triggered and installs both files?

Those are for other build systems.

But I see the original PBE.QOwnNotes.desktop get installed by snap with the QOwnNotes.pro install routine: https://launchpadlibrarian.net/496188886/buildlog_snap_ubuntu_bionic_amd64_qownnotes_BUILDING.txt.gz

But that also seems to happen on the edge channel's build process: https://snapcraft.io/qownnotes/builds/1106554 (I think you might have no permissions to view this).

So did you have the same issue on the edge channel?

pbek commented 4 years ago

And for what I see also in the past there always seems that two desktop files might be the desktop files around inside the snap. But I'm not sure why/if they are also made available outside the snap...

datumbox commented 4 years ago

@pbek I think you are right. It's likely it happened on the edge channel yesterday and we did not notice. I caught it today because I decided to do a full reinstall to check it end-to-end.

But before your commit that renames the file, I am confident though that there was only one file in /var/lib/snapd/desktop/applications.

pbek commented 4 years ago

And that one file was qownnotes_PBE.QOwnNotes.desktop?

What's the content of the current two files?

datumbox commented 4 years ago

That's correct.

They are identical with only difference their name in the exec record:

$ diff /var/lib/snapd/desktop/applications/qownnotes_PBE.QOwnNotes.desktop /var/lib/snapd/desktop/applications/qownnotes_qownnotes.desktop
5c5
< Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/qownnotes_PBE.QOwnNotes.desktop /snap/bin/qownnotes
---
> Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/qownnotes_qownnotes.desktop /snap/bin/qownnotes
pbek commented 4 years ago

That's interesting. It seems snapcraft took the desktop file that should be used plus the original one, but modified the original one to use the correct path in the snap. I don't know yet how to prevent snapcraft using the original one.

pbek commented 4 years ago

@datumbox can you please install the edge snap again and confirm that there are two desktop icons too, so I have a space to test new fixes.

pbek commented 4 years ago

@datumbox, you can skip above comment and go straight to the 20.9.3 (stable) release to test

20.9.3

datumbox commented 4 years ago

@pbek Unfortunately the problem persists:

$ sudo snap remove qownnotes 
qownnotes removed

$ ls -lh /var/lib/snapd/desktop/applications/*qown*
ls: cannot access '/var/lib/snapd/desktop/applications/*qown*': No such file or directory

$ sudo snap install qownnotes
qownnotes 20.9.3 from Patrizio Bekerle (pbek) installed

$ ls -lh /var/lib/snapd/desktop/applications/*qown*
-rwxr-xr-x 1 root root 417 Sep  6 09:51 /var/lib/snapd/desktop/applications/qownnotes_PBE.QOwnNotes.desktop
-rwxr-xr-x 1 root root 413 Sep  6 09:51 /var/lib/snapd/desktop/applications/qownnotes_qownnotes.desktop

$ diff /var/lib/snapd/desktop/applications/qownnotes_PBE.QOwnNotes.desktop /var/lib/snapd/desktop/applications/qownnotes_qownnotes.desktop
5c5
< Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/qownnotes_PBE.QOwnNotes.desktop /snap/bin/qownnotes
---
> Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/qownnotes_qownnotes.desktop /snap/bin/qownnotes
pbek commented 4 years ago

That's strange. There is no .desktop file deployed in https://launchpadlibrarian.net/496503235/buildlog_snap_ubuntu_bionic_arm64_qownnotes_BUILDING.txt.gz.

datumbox commented 4 years ago

It is still in there:

Screenshot: screenshot

You can confirm this also by checking the snap on the disk:

$ ls -lh /snap/qownnotes/7403/meta/gui
total 30K
-rw-r--r-- 1 root root 285 Sep  6 08:17 PBE.QOwnNotes.desktop
-rw-r--r-- 1 root root 285 Sep  6 08:17 qownnotes.desktop
-rw-r--r-- 1 root root 29K Sep  6 08:17 QOwnNotes.png
pbek commented 4 years ago

Thank you for confirming! I really wonder who puts it in there and why...

datumbox commented 4 years ago

@pbek I think Snap picks up the PBE.QOwnNotes.desktop file because it is in the src directory of the build.

I found this article in the documentation that explains where the desktop files can be deployed. Apparently it also supports getting it from your prime directory.

Unfortunately I have not released myself any application using snaps to tell you how you could blacklist the deployment of specific files. It's worth asking the people at snapcraft. Hopefully it's straightforward.

pbek commented 4 years ago

@datumbox, can you please try the current build from the edge channel, I attempted to remove src/PBE.QOwnNotes.desktop while building the snap.

datumbox commented 4 years ago

@pbek You fixed it!!! :D Thanks a lot for your help!

pbek commented 4 years ago

Oh man, that was a hard one. Thank you for testing. Then I will try to do the same for the production snap for the next release.