ImHex
ImHex copied to clipboard
[Bug] Open File dialog doesn't work in WLRoots based environnments
Operating System
Linux
What's the issue you encountered?
The open file dialog doesn't do anything.
How can the issue be reproduced?
-
yay -S imhex
- Launch
-
Open File
- Observe
ImHex Version
1.21.2
ImHex Build Type
- [ ] Nightly or built from sources
Additional context?
- Wayland (Hyprland, WLRoots)
- Arch Linux
- RX 6700XT
Logs:
[15:53:08] [INFO] [main] Welcome to ImHex!
[15:53:08] [INFO] [main] Native scaling set to: 1.0
[15:53:08] [ERROR] [main] GLFW Error [65544] : Wayland: Window position setting not supported
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
[15:53:11] [ERROR] [main] GLFW Error [65544] : Wayland: Window position setting not supported
[15:53:11] [ERROR] [main] GLFW Error [65544] : Wayland: Window position retrieval not supported
[15:53:11] [ERROR] [main] GLFW Error [65544] : Wayland: Focusing a window requires user interaction
Hey
This is a known "Issue" with certain linux installations. Make sure xdg-desktop-portal
and a frontend for it is correctly installed and setup on your system. After that it should work fine
I'd appreciate if this issue was reopened. xdg-desktop-portal
is running fine and other apps can use it.
Could you try with the imhex-bin
package? That's the officially one released by us. I just tried it on EndeavourOS and the file explorer works completely fine there for me.
So I assume this is most likely an issue with your system
if imhex-bin
is the official one, then why is imhex
in the readme?
Also, it doesn't work in imhex-bin
either.
It was added by a PR and I apparently didn't check it well enough, should be fixed now. Thank you.
iirc some people had to also install xdg-deskop-portal-gtk
but this highly depends on your system and your setup.
@iTrooz Do you have a better idea maybe? If not, I'm not sure I can help you. Linux setups are so diverse and unique that it's hard to properly provide instructions for every one of them
iirc some people had to also install
xdg-deskop-portal-gtk
but this highly depends on your system and your setup.
That's only for GNOME. As per the specs, I'm on Hyprland (wlroots) so I need xdg-desktop-portal-wlroots
instead.
Hello ! Indeed you will need to install the right xdg-desktop-portal backend for your desktop environment, which seems to be https://archlinux.org/packages/community/x86_64/xdg-desktop-portal-wlr/ in your case Could you try it ? (please reboot before testing, to make sure the daemon is started)
That's only for GNOME. As per the specs
I think it should still work, but it will show a GTK UI instead of a native (wlroots) one
I feel like you didn't read my previous comments. xdg desktop portal already works fine on my system, and other apps can use it.
Oops, indeed I didn't read that comment
Could you try the file picker in the AppImage version ?
Also, which xdg-desktop-portal backend(s) do you have currently ?
% yay -Qs xdg-desktop-portal
local/xdg-desktop-portal 1.15.0-1
Desktop integration portals for sandboxed apps
local/xdg-desktop-portal-wlr-hyprland-git v0.6.0.r1.g1cc5ff5-1
xdg-desktop-portal-wlr with workarounds applied for the Hyprland compositor
Also, it doesn't work in the appimage either.
This is really strange. I just tested the 1.22.0 AppImage on ArchLinux and Fedora (Both KDE), and the file picker worked
Well, yea, you tested it with KDE. That's not WLRoots. Judging by the logs I sent, it seems that ImHex needs to add WLRoots support, as each XDG Desktop Portal (GNOME, KDE, WLRoots) is different.
I don't think xdg-desktop-portal works that way. AFAIK it relies on backend implementations that can be queried using the same interface over dbus, so we shouldn't have to do anything special to add support for it. And we didn't do anything special to "add" support for KDE, for example
Are the error in your logs occuring when you start the application, or when you try to launch the file picker ?
I don't think xdg-desktop-portal works that way. AFAIK it relies on backend implementations that can be queried using the same interface over dbus, so we shouldn't have to do anything special to add support for it. And we didn't do anything special to "add" support for KDE, for example
Sort of, but WLRoots is very finicky in comparison to GNOME and KDE and often needs special support from other apps.
Are the error in your logs occuring when you start the application, or when you try to launch the file picker ?
When I launch the application.
To be quite frank, I don't think it's worth it then to support it. Again, there are so many different setups on Linux, supporting every last one of them gets hard very quickly.
If you would like to somehow get support added, I think the best way is to either talk to the Hyperland devs to add better support for xdg-desktop-portal so applications don't need to add workarounds for it or talk to the dev of the library we use to display the file dialog: https://github.com/btzy/nativefiledialog-extended I don't know of any thing I could change in ImHex for it to work.
About those error messages, they can be ignored. You're using Wayland which prevents applications from moving their own window or focus themselves. ImHex tries to do that to center the splash screen at the start which just fails on Wayland. There's a few other things like multi viewport support that Wayland also prevents from working but that is disabled when Wayland is detected.
WerWolv is right, it should not be up to us to implement it, but to the xdg-desktop-portal backend/nfd/Hyperland devs I am going to install WLRoots to try to see where the problem is exactly so I can file an issue accordingly
Go ahead if you want to do some debugging on your side and report your findings !
It would moreso be the WLRoots devs, as Hyprland is just using it as the base for the compositor (I'm on the Hyprland dev team!)
If I have time later I can try on Sway/Wayfire/River, which all also use WLRoots.
I can confirm that the issue happens on Sway currently. None of the above mentioned packages seem to make ImHex's file picker dialog to pop up.
xdg-desktop-portal
is running fine and other apps can use it.
Hey, could you give a app which open the file picker ?
Also, could you try to compile https://github.com/btzy/nativefiledialog-extended with the cmake flag -DNFD_BUILD_TESTS=ON
and try some test programs ?
Seems fine to me
Here are my findings :
-
At some point I got Sway to work, but it was using the KDE backend Others WM I tested Wayfire and Hyprland) were throwing some error about the KDE backend timing out IIRC
-
After removing xdg-desktop-portal-kde (pacman -Rdd), the xdg-desktop-portal service did still start in Sway but opening a file picker resulted in
Error: No such interface “org.freedesktop.portal.FileChooser” on object at path /org/freedesktop/portal/desktop
Some logs :
[swayuser@arch-3306 ~]$ systemctl --user status xdg-desktop-portal
â—‹ xdg-desktop-portal.service - Portal service
Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
Active: inactive (dead)
Sep 12 10:02:49 arch-3306 systemd[6043]: Starting Portal service...
Sep 12 10:02:49 arch-3306 xdg-desktop-por[6347]: No skeleton to export
Sep 12 10:02:49 arch-3306 systemd[6043]: Started Portal service.
Sep 12 10:08:39 arch-3306 systemd[6043]: Stopping Portal service...
Sep 12 10:08:39 arch-3306 systemd[6043]: Stopped Portal service.
[swayuser@arch-3306 ~]$ systemctl --user start xdg-desktop-portal
[swayuser@arch-3306 ~]$ systemctl --user status xdg-desktop-portal
â—Ź xdg-desktop-portal.service - Portal service
Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
Active: active (running) since Mon 2022-09-12 10:09:08 CEST; 805ms ago
Main PID: 8389 (xdg-desktop-por)
Tasks: 5 (limit: 18411)
Memory: 5.9M
CPU: 47ms
CGroup: /user.slice/user-1005.slice/[email protected]/session.slice/xdg-desktop-portal.service
└─8389 /usr/lib/xdg-desktop-portal
Sep 12 10:09:07 arch-3306 systemd[8114]: Starting Portal service...
Sep 12 10:09:07 arch-3306 xdg-desktop-por[8389]: No skeleton to export
Sep 12 10:09:08 arch-3306 systemd[8114]: Started Portal service.
[swayuser@arch-3306 ~]$ cd /mnt
[swayuser@arch-3306 mnt]$ ls
a imhex-1.22.0.AppImage nativefiledialog-extended test
[swayuser@arch-3306 mnt]$ ./test
Error: No such interface “org.freedesktop.portal.FileChooser” on object at path /org/freedesktop/portal/desktop
in Wayfire, the service still did not start, for exactly the same reason as with the KDE backend IIRC :
â—Ź xdg-desktop-portal.service - Portal service
Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
Active: active (running) since Mon 2022-09-12 09:59:37 CEST; 19s ago
Main PID: 5203 (xdg-desktop-por)
Tasks: 4 (limit: 18411)
Memory: 5.8M
CPU: 45ms
CGroup: /user.slice/user-1004.slice/[email protected]/session.slice/xdg-desktop-portal.service
└─5203 /usr/lib/xdg-desktop-portal
Sep 12 09:59:11 arch-3306 systemd[4962]: Starting Portal service...
Sep 12 09:59:11 arch-3306 xdg-desktop-por[5203]: No skeleton to export
Sep 12 09:59:37 arch-3306 xdg-desktop-por[5203]: Failed to create screen cast proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.wlr: Timeout was reached
Sep 12 09:59:37 arch-3306 xdg-desktop-por[5203]: No skeleton to export
Sep 12 09:59:37 arch-3306 systemd[4962]: Started Portal service.
~~I didn't test Hyprland~~ EDIT : same error as in Wayfire
Note : these tests were made on my actual computer, which is normally an ArchLinux KDE environment
ThatOneCalculator, I know other programs worked, but could you check the output of systemctl --user status xdg-desktop-portal
(is there any difference before and after trying to open the file picker in ImHex ?)
NOTE : I just realized backends have their own service (I was wondering how they worked) so I'm going to check that right now
Woah, I have a lot of things to process I'm still confused so I may have got some things wrongs, but here is what I've think I've understood/done :
-
First, my issue with the service timeout in wayfire/hyprland was fixed by
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
. What's strange is that the command seems to be mentionned in https://github.com/emersion/xdg-desktop-portal-wlr to fix Sway, but it's the only one that works without it. So the 3 WM have the same error. -
I think that in the end, the problem doesn't come from wlroot (
xdg-desktop-portal-wlr
), but from the hyprland-specific package (in the case of hyprland)xdg-desktop-portal-wlr-hyprland-git
. I didn't read your installed packages well and thought it wasxdg-desktop-portal-wlr
, which do not offer the file picker functionality (which explains the errors I got, and why the KDE backend was used at first)
xdg-desktop-portal-wlr
was the only one available for me to install tho, which is why I confused them. The package you are using was at https://aur.archlinux.org/packages/xdg-desktop-portal-wlr-hyprland-git but seems to not be available anymore (404), and I can't find upstream.
Where did you get it ?
fwiw, i'm still seeing this issue on hyprland as well - fwiw, the package is https://aur.archlinux.org/packages/xdg-desktop-portal-hyprland-git (no -wlr
in the package name). The repo for that is here; I skimmed through what it's changed from the -wlr implementation and it looks like most (all?) of the changes are around screensharing.
(Notably, xdg-desktop-portal-wlr
exhibits the same symptoms for me - No such interface “org.freedesktop.portal.FileChooser” on object at path /org/freedesktop/portal/desktop
. I'm unsure what's up with the -wlr desktop portal backend and other backends deriving from it, but it does appear to just be a -wlr issue, unfortunately.
it's worth noting that xdg-desktop-portal-wlr
only implements screenshotting and screencasting, so this will never work with just the wlr
backend
$ xcat xdg-desktop-portal-wlr-0.7.0_1 /usr/share/xdg-desktop-portal/portals/wlr.portal
[portal]
DBusName=org.freedesktop.impl.portal.desktop.wlr
Interfaces=org.freedesktop.impl.portal.Screenshot;org.freedesktop.impl.portal.ScreenCast;
UseIn=wlroots;sway;Wayfire;river;phosh;Hyprland;
the gnome
, gtk
, kde
, and lxqt
backends implement .FileChooser
so they should work (but don't in a minimal sway setup I stood up for testing)
with some further testing, I was able to get it to work in sway, with /usr/libexec/xdg-desktop-portal
and /usr/libexec/xdg-desktop-portal-gtk
running in terminals instead of being launched by dbus. this tells me it's probably some kind of environment issue? I also needed to install gsettings-desktop-schemas
to get the gtk
portal to launch.