johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
5.93k stars 273 forks source link

[Bug] Click icon can't open Foliate #1131

Closed signdo closed 9 months ago

signdo commented 9 months ago

Describe the bug

Click icon can't open the Foliate. But run command flatpak run com.github.johnfactotum.Foliate will open it.

Expected behavior Click app icon, then it will be launched.

Version:

Additional context

$ flatpak run com.github.johnfactotum.Foliate 

(com.github.johnfactotum.Foliate:2): com.github.johnfactotum.Foliate-WARNING **: 13:33:30.444: Gio.IOErrorEnum: Access to service is disallowed 'SERVICE'
getURIFromTracker@resource:///com/github/johnfactotum/Foliate/library.js:30:30
get@resource:///com/github/johnfactotum/Foliate/library.js:56:42
getBookFromIdentifier@resource:///com/github/johnfactotum/Foliate/library.js:105:36
getBook@resource:///com/github/johnfactotum/Foliate/library.js:101:21
activate@resource:///com/github/johnfactotum/Foliate/library.js:394:63
activate@resource:///com/github/johnfactotum/Foliate/library.js:322:18
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34

Failed to create /home/me/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling.
Failed to create /home/me/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling.
Failed to create /home/me/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling.
Failed to create /home/me/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling.
Failed to create /home/me/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling.
Failed to create /home/me/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling.
Failed to create /home/me/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling.
Failed to create /home/me/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling.
signdo commented 9 months ago

Normally right-click the App icon to display the menu: Screenshot from 2023-11-16 13-16-56

Foliate: Screenshot from 2023-11-16 13-15-45

Click Unnamed but nothing happen. Maybe that's why I can't start it?

johnfactotum commented 9 months ago

No, although that is a bug (which has been fixed in git), with this bug I can still open it fine.

I don't know if there's a better way to troubleshoot this, but you can try and find the .desktop file (see https://discourse.flathub.org/t/where-are-all-the-installed-desktop-files-located-for-each-application/2147) and inspect it to see if there's anything wrong with the way it's launching the app.

signdo commented 9 months ago

Referring to the article link you sent, I compared the .desktop file of other Flatpak app. And then modify the /var/lib/flatpak/exports/share/applications/com.github.johnfactotum.Foliate.desktop.

I re-logged in the desktop after attaching the following content to the file, it is now open normally, and also fixed the bug of right-click displaying Unnamed :

[Desktop Action new-window]
Name=New Window
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=foliate --file-forwarding com.github.johnfactotum.Foliate @@u %U @@

I just added these lines, not change the original content.

johnfactotum commented 9 months ago

It works for me even with the missing action, though. Are you sure that's what's causing this? Does it fail to launch if you run the unmodified .desktop file with gio launch?

But I guess the missing desktop action is already removed, so there's nothing that needs to be done anymore, either way.

signdo commented 9 months ago

I tried to remove the extra lines I had added and re-logged into the desktop. Then click icon to open the Foliate, which results in the same failure as before. Then run gio launch /var/lib/flatpak/exports/share/applications/com.github.johnfactotum.Foliate.desktop. It can be opened.

I suspect that this happens due to the different versions of Flatpak or other related software used. My Flatpak version is 1.14.4 on Debian12.

signdo commented 9 months ago

Oh, please forgive me for Posting the last comment, now I know the real reason.

https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#extra-actions

I noticed the superfluous content Actions=new-window; in line 64, which is the presence of which prevents clicking on icon to open the Foliate if not implement it. I deleted it and now I can open the Foliate normally when I re-login.

johnfactotum commented 9 months ago

OK. Thanks for testing. I guess we can close this as a duplicate of #1111.