Bug 456987 - Open with... not working in AppImage
Summary: Open with... not working in AppImage
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Usability-OpenWith (show other bugs)
Version: 8.1.0
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-21 16:04 UTC by Milan Knížek
Modified: 2023-10-11 05:45 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.2.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Knížek 2022-07-21 16:04:36 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Run `/Applications/digiKam-7.7.0-x86-64.appimage` from terminal
2. Select any album to show thumbnails of photos in main view.
3. Right click on a thumbnail and choose `Open With...`

OBSERVED RESULT

The list is empty.

EXPECTED RESULT

The list includes applications which can open the image type (JPEG in my case).

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 22.04 (minimal desktop installation)  
(available in About System)
KDE Plasma Version:  5.24.4 (not listed in Help // About digiKam // Components, though)
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.3 (built against 5.15.3)

ADDITIONAL INFORMATION

Further info:
- Open in File Manager => Dolphin opens with the respective folder, the image file is not pre-selected, though.
- Open With... and manually typing in `/Applications/Darktable.appimage %U` opens darktable with the image displayed. The Open With... list remains empty afterwards, anyway.
- In Dolphin: `Open With` shows a list of apps (GIMP, darktable, ...) as expected.
Comment 1 Maik Qualmann 2022-07-21 17:47:40 UTC
Git commit 090de1623f4ea25e1eb14254ffad7600d7f04872 by Maik Qualmann.
Committed on 21/07/2022 at 17:46.
Pushed by mqualmann into branch 'qt5-maintenance'.

add test debug to show KSycoca database file path

M  +3    -0    core/app/main/main.cpp

https://invent.kde.org/graphics/digikam/commit/090de1623f4ea25e1eb14254ffad7600d7f04872
Comment 2 Maik Qualmann 2022-07-21 21:37:33 UTC
I installed Kubuntu in a VM to test it. We need to set the environment variable "KDESYCOCA" to the absolute path to the local database in the cache directory. Then "Open with..." works fine.

Example: export KDESYCOCA=/home/USERNAME/.cache/ksycoca5_LANG_XXXXXXXXX

Maik
Comment 3 Milan Knížek 2022-07-22 17:07:45 UTC
Indeed, it works then.

How do I find out which ksycoca*XXXXXXXX it actually is/will be (from within a bash script which will eventually run digiKam AppImage)?
Comment 4 Maik Qualmann 2022-07-22 18:33:45 UTC
It is probably the most recent file. I think we can automate it. I'm downloading Ubuntu right now and want to see if "Open with..." can make it available here too.

@Gilles, can you please create a new AppImage? It would be good to know the current debug output of KSycoca.

Maik
Comment 5 Maik Qualmann 2022-07-22 20:16:59 UTC
Git commit c09c3129112d1349ad86e33dcb9aecfcbf3e31a5 by Maik Qualmann.
Committed on 22/07/2022 at 20:14.
Pushed by mqualmann into branch 'qt5-maintenance'.

first try to fix "Open with..." in the AppImage bundle
Related: bug 456833

M  +2    -0    core/app/main/main.cpp
M  +5    -0    core/app/utils/digikam_globals.h
M  +29   -0    core/app/utils/digikam_globals_bundles.cpp
M  +2    -0    core/showfoto/main/main.cpp

https://invent.kde.org/graphics/digikam/commit/c09c3129112d1349ad86e33dcb9aecfcbf3e31a5
Comment 6 caulier.gilles 2022-07-22 20:35:43 UTC
Hi Maik,

If the master code is fine, try the build factory. You can force to create new one through the web interface. Just login and look the new option on the menu from left side bar. 

https://binary-factory.kde.org/view/AppImage/job/Digikam_Nightly_appimage-centos7/

Else, a new build is done automatically each day.

Gilles

note : I'm not at home this week end with a limited Internet access.
Comment 7 Maik Qualmann 2022-07-22 20:58:58 UTC
Ah yes, I hadn't even thought of that. I see you've already started it.

Maik
Comment 8 Maik Qualmann 2022-07-23 06:40:49 UTC
The Nightly AppImage is not suitable for testing at the moment. Solid doesn't seem to work. Und because our AppRun script isn't used, it doesn't detect that we're in an AppImage.

Maik
Comment 9 Maik Qualmann 2022-07-23 06:42:52 UTC
Since the MSVC build is running quite well, I will test whether we can also implement "Open with..." under Windows with the appropriate *.desktop files.

Maik
Comment 10 caulier.gilles 2022-07-23 07:22:22 UTC
Git commit f68e44a118572874023048154916eaacc4dced15 by Gilles Caulier.
Committed on 23/07/2022 at 07:21.
Pushed by cgilles into branch 'master'.

add customized Craft AppImage env variables

M  +35   -0    extragear/digikam/digikam.py

https://invent.kde.org/packaging/craft-blueprints-kde/commit/f68e44a118572874023048154916eaacc4dced15
Comment 11 caulier.gilles 2022-07-23 07:28:08 UTC
Maik,

I restart a new AppImage build, this time with 80% of hand maid AppImage AppRun script. This can be customized in Craft.

To experiment, download the AppImage bundle, and run :

./digikam-master-XX-linux-64-gcc.AppImage --appimage-extract

This will uncompress all bundled files in local dir named 'squashfs-root'. You can play with it as you want...

Gilles
Comment 12 caulier.gilles 2022-07-23 08:01:40 UTC
MAik,

The AppImage build #67 must be better now.

Gilles
Comment 13 Maik Qualmann 2022-07-23 13:55:42 UTC
Tested on Kubuntu, AppImage aborts because it cannot find the database configuration file. I will try to fix it.

Maik
Comment 14 Maik Qualmann 2022-07-23 16:45:33 UTC
The problem is that QStandardPaths - without patching it - always looks in the host system. We would have to convert all QStandardPaths calls in digiKam that access program resources. But I don't think that's a good idea at the moment.

Maik
Comment 15 caulier.gilles 2022-07-24 08:37:25 UTC
Git commit 15c5911da1bf0b09d04be41743ca50dbe17e93c9 by Gilles Caulier.
Committed on 24/07/2022 at 08:36.
Pushed by cgilles into branch 'master'.

Use same AppRun script for AppImage than one from hand maid bundle.

A  +210  -0    extragear/digikam/AppRun
M  +12   -35   extragear/digikam/digikam.py

https://invent.kde.org/packaging/craft-blueprints-kde/commit/15c5911da1bf0b09d04be41743ca50dbe17e93c9
Comment 16 caulier.gilles 2022-07-24 08:41:29 UTC
Maik, 

Now, with the next AppImage build, we we use exactly the same startup script than hand maid bundle.

About your QStandardPaths problem, i really surprised as i don't touch QStandardPaths rules in digiKam while recompiling application for AppImage (hand maid).

Note that i do it for MacOS bundle:

https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/macports/fixbundledatapath.sh

Gilles
Comment 17 caulier.gilles 2022-07-24 13:42:45 UTC
Maik,

Look this comment from Craft core :

https://invent.kde.org/packaging/craft/-/blob/master/bin/Packager/AppImagePackager.py#L12

It's clear. With my previous patch to AppImage packager, where i tune some env. variable in startup script, the default one is removed, so these lines are gone, and the problem with QStandardPaths appear.

My current patch to include the hand maid AppRun do not work. File is always overrides by Craft. I need to find another solution.

Gilles
Comment 18 Maik Qualmann 2022-07-26 20:16:36 UTC
Git commit 25e62eb7d63c5ca915d92021ddb3433c21cb53ac by Maik Qualmann.
Committed on 26/07/2022 at 20:15.
Pushed by mqualmann into branch 'qt5-maintenance'.

ignore self-created KSycoca database if others exist
Related: bug 456833

M  +13   -5    core/app/utils/digikam_globals_bundles.cpp

https://invent.kde.org/graphics/digikam/commit/25e62eb7d63c5ca915d92021ddb3433c21cb53ac
Comment 19 Maik Qualmann 2022-07-30 11:39:02 UTC
"Open with..." now works well on Kubuntu.
Please test the pre-release AppImage digiKam-7.8.0 from here:

https://files.kde.org/digikam/

Maik
Comment 20 Milan Knížek 2022-07-30 13:20:23 UTC
Indeed! Thanks.
Comment 21 Milan Knížek 2023-05-02 19:01:06 UTC
The same bug is back in AppImage 8.0.0 - Kubuntu 22.04.
Comment 22 Maik Qualmann 2023-05-02 19:32:27 UTC
It's hard to understand why "Open with..." doesn't work under Kubuntu, since Gilles is now building the AppImage under Kubuntu. Here under openSUSE no problems with it.
The workaround we did here no longer works is because setting the environment variable caused other Kubuntu users to "dissolve" their KDE start menu after running digiKam for a longer period of time. Therefore we had to adapt the code so that it is only used on non-KDE desktops.

Maik
Comment 23 caulier.gilles 2023-05-24 04:37:34 UTC
I just tested with 8.1.0 AppImage pre-release, and open with still empty under Kubuntu 22.04.
Comment 24 caulier.gilles 2023-10-10 03:30:05 UTC
@Milan,

Please give us a fresh feedback using the current digiKam AppImage Linux bundle
pre-release 8.2.0 available here:

https://files.kde.org/digikam/

This one is compiled with last Qt 5.15.11 (previous one used Qt 5.15.7). Here with Kubuntu 23.04, the Open With menu work as expected.

Thanks in advance

Gilles Caulier
Comment 25 caulier.gilles 2023-10-11 05:45:21 UTC
Not reproducible at all with AppImage 8.2.0 pre-release, under Kubuntu 22.04 and later. Closed...