ImHex
ImHex copied to clipboard
[Feature] Geting rid of xdg-desktop-portal
What feature would you like to see?
Compiling on Linux without portals support.
How will this feature be useful to you and others?
After long troubleshooting of problems similar to #723 I ended up in removing portal stuff and searching ways to build ImHex without it. As I realized, portals used only in NFD and it provides option to use GTK by default, that you override in not obvious way. But install GTK is a way more easier than a setting up buggy portals (maybe I'm wrong of cource).
Request Type
- [X] I can provide a PoC for this feature or am willing to work on it myself and submit a PR
Additional context?
I do not understand why here is forced usage of portals, maybe because of way that interface draws (as I see it is not redrawing while gtk file dialog open), but I want to know. Anyway, I think it's more preferable to have somehow-working app instead of "LOL your portals not working". Or at least getting usable errors on logs.
The reason why I chose portals is because of the Flatpak and AppImage build. There you have no choice but to use portals, otherwise the file picker can't be used at all.
I'm open for a compile time flag to switch over to GTK if needed. However, release builds should probably still use portals since packaging GTK is both pretty difficult and increases the build sizes by a lot
Okay, for self-packed versions it is must have, got it.
For compilation it will be cool to be able e.g. find in readme that I can pass -D NFD_PORTAL=OFF
to cmake and get it works without portals. Currently if USE_SYSTEM_NFD
is not set, cmake force portals to ON, so passing arguments useless.
Maybe it can be just PORTAL
flag in case of something else will use its in future.
Added an option for it. You can now set IMHEX_USE_GTK_FILE_PICKER
to ON at configuration time to make ImHex use the GTK file picker instead
Just want to put for reference for others that if USE_SYS_NFD
is on, then IMHEX_USE_GTK_FILE_PICKER
has basically no effect since the shared library’s implementation will decide whether portal or GTK will be used (which is configured at its compile time).
For example, Fedora’s nativefiledialog-extended
package does not enable portal, so it will always use the gtk file picker. In this case, you need to either build imhex
with statically linked NFD, or build your own NFD with portal enabled and put it in LD_LIBRARY_PATH
(so other dynamically linked programs will use portal too). One caveat: desktop entry need env var or shelled to take account of this path.