You are not logged in.

#1 2024-04-26 21:01:18

fhftsai256
Member
Registered: 2020-05-12
Posts: 14

[SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

After doing `pacman -Syu` today, double-clicking a file in KDE Dolphin no longer opens it with its default MIME application. Instead, an empty application selection window pops up, and I could not find any "mimeapps.*" under my home folder.

So I started up "/usr/lib/xdg-desktop-portal -rv" and tried to assign okular to open up a PDF file, and it says:

XDP: Assigning app ID "/usr/bin/okular" to pid 37922 which has unit "app-\x2fusr\x2fbin\x2fokular@e94b2dcea12f4894aed16c57517d142a.service"

And if I check "Remember application association for all files of type 'PDF document' (application/pdf)", it will prompt:

XDP: Assigning app ID "okular-4" to pid 38588 which has unit "app-okular\x2d4@0d2aafcbe0f246d593ab4ae574322e4e.service"

Then the file ~/.config/mimeapps.list is created with following entry, but will still give me the empty app selection window if I try to open the same file:
(the suffix number will increase by 1 every time I do this, e.g. it shall assign "okular-5" next time)

[Added Associations]
application/pdf=okular-4.desktop;

[Default Applications]
application/pdf=okular-4.desktop;

However, Dolphin works perfectly fine on Plasma 6, and Thunar doesn't have this problem on Hyprland.
I wonder if xdg-desktop-portal has anything to do with it.
The KDE portal seems loaded properly with config ~/.config/xdg-desktop-portal/hyprland-portals.conf

[preferred]
default=hyprland;gtk
org.freedesktop.impl.portal.FileChooser=kde
org.freedesktop.impl.portal.AppChooser=kde

with the following log

XDP: Found 'kde' in configuration for org.freedesktop.impl.portal.FileChooser
XDP: Using kde.portal for org.freedesktop.impl.portal.FileChooser (config)
XDP: providing portal org.freedesktop.portal.FileChooser
XDP: Found 'kde' in configuration for org.freedesktop.impl.portal.AppChooser
XDP: Using kde.portal for org.freedesktop.impl.portal.AppChooser (config)
XDP: providing portal org.freedesktop.portal.OpenURI

Any ideas where I should look at? Thanks.

Last edited by fhftsai256 (2024-04-27 21:50:48)

Offline

#2 2024-04-27 03:53:13

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 30
Website

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

I can confirm that! ALL filetype/mime-associations within Dolphin were lost since this morning's updates (on AwesomeWM/X11). Everything was working fine yesterday evening. I'm still investigating...

Offline

#3 2024-04-27 04:45:12

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 30
Website

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

Also, the 'Default applications' and 'file associations' from the KDE System Settings are lost.

The only apps I upgraded today were: argyllcms, element-web, element-desktop, lib32-gnutls, python-mako. Nene of those shouldn't have anything to do with KDE, but I downgraded them anyway and rebooted. NO luck. WTF.

Offline

#4 2024-04-27 06:42:38

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,153

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

Install archlinux-xdg-menu and run

XDG_MENU_PREFIX=arch- kbuildsycoca6

Online

#5 2024-04-27 08:22:32

blutlauge
Member
Registered: 2024-04-27
Posts: 4

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

Maybe the following issue which occured only recently is somehow related. First I observed that it was no longer possible to open a file via nnn or lf file managers. Instead of opening the file the system produces another file called "test.--version" in the current directory and starts eating up the whole RAM until it eventually freezes.

I further investigated the issue and found out that there is not a single "mimeapps.list" file present on the system and that the command

xdg-mime query filetype FILE

seems to cause the problem.

Furthermore it is worth noting that this issue only occurs when using a window manager (dwm, herbstluftwm) and not when using a desktop environment  (XFCE, Gnome). But even in a Gnome session I get the error

No session bus: Error spawning command line “dbus-launch --autolaunch=51ce5834b2b147db829bedfc2204a633 --binary-syntax --close-stderr”: Child process exited with code 1

when I execute the command "/usr/lib/xdg-desktop-portal -rv".

Offline

#6 2024-04-27 19:37:51

fhftsai256
Member
Registered: 2020-05-12
Posts: 14

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

kbuildsycoca6 complained the file "applications.menu" is missing from /etc/xdg/menus, and then I realized the file had been renamed to "plasma-applications.menu." Therefore, to work around the pain point:

sudo ln -s /etc/xdg/menus/plasma-applications.menu /etc/xdg/menus/applications.menu

I'm not comfortable with this hack. Apparently, the solution from @arojas makes the most sense to me so far, based on this wiki page:
https://wiki.archlinux.org/title/Xdg-menu

Last edited by fhftsai256 (2024-04-27 21:37:08)

Offline

#7 2024-04-27 20:29:35

blutlauge
Member
Registered: 2024-04-27
Posts: 4

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

Well, it seems that my issue is not related to this thread. I will consider opening another thread.

Offline

#8 2024-04-28 07:49:50

kicka
Member
From: Sicily / Italy
Registered: 2012-10-18
Posts: 26

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

Instead of creating a link, I inserted the following lines on '$HOME/.config/hypr/hyprland.conf':

# File association in dolphin.
env = XDG_MENU_PREFIX,plasma-

rebooted, and everything works again.
Though it may help.

Offline

#9 2024-04-29 02:01:00

fhftsai256
Member
Registered: 2020-05-12
Posts: 14

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

kicka wrote:

Instead of creating a link, I inserted the following lines on '$HOME/.config/hypr/hyprland.conf':

# File association in dolphin.
env = XDG_MENU_PREFIX,plasma-

rebooted, and everything works again.
Though it may help.

This is so elegant that my tears burst out. Thank you very much.

Offline

#10 2024-05-01 11:06:43

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 30
Website

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

Thank you guys for figuring this out! I've been afk for some days so I couldn't investigate this myself.

So, for startx/bash users, it is

export XDG_MENU_PREFIX=plasma-

in the .xinitrc

That just leaves a question about why the KDE developers chose to mess with the XDG specification like that?

Offline

#11 2024-05-01 15:59:57

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,153

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

cyberpunkrocker wrote:

That just leaves a question about why the KDE developers chose to mess with the XDG specification like that?

Quite the opposite: KDE is now following the specification strictly.

Online

#12 2024-05-02 17:55:57

zacstewart
Member
Registered: 2021-10-27
Posts: 5
Website

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

arojas wrote:

Install archlinux-xdg-menu and run

XDG_MENU_PREFIX=arch- kbuildsycoca6

I also recently ran into this problem after a pacman -Syu. Quoted "fixed" the problem, but not completely. I use Dolphin on sftp a lot, and previously it would open files with sftp:// links (for example in Kwrite). Now it's downloading the file locally to ~/.cache/kioexec and opening the copy.

Offline

#13 2024-05-03 11:10:12

Octelly
Member
From: Czechia
Registered: 2024-05-03
Posts: 1

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

All fixes involving kbuildsycoca6 have only worked temporarily for me, until I try to change the default app for a given file type to be specific. I'm not sure this topic is "solved" yet, but that is for the OP to decide I believe.

I had dolphin on my system and in the process of troubleshooting I also installed kf5, kf6 and xdg-desktop-portal-kde for good measure. Here's my ~/.config/xdg-desktop-portal/hyprland-portals.conf:

[preferred]
# use xdg-desktop-portal-gtk for every portal interface
default=shana;hyprland;gnome;kde
# except for the xdg-desktop-portal-wlr supplied interfaces
org.freedesktop.impl.portal.Screencast=hyprland
org.freedesktop.impl.portal.Screenshot=hyprland

Offline

#14 2024-05-03 11:24:13

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,153

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

Octelly wrote:

All fixes involving kbuildsycoca6 have only worked temporarily for me, until I try to change the default app for a given file type to be specific. I'm not sure this topic is "solved" yet, but that is for the OP to decide I believe.

You need to set the XDG_MENU_PREFIX env variable permanently, for your full session.

Online

#15 2024-05-03 18:46:24

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 30
Website

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

Well the menus broke again with qt6-base update, albeit temporarily. Although XDG_MENU_PREFIX was set, it seems that I need to run kbuildsycoca6 every time there's a qt6/kde6-related update. Need to add that to my startup scripts...

Offline

#16 2024-05-05 08:36:46

soylens
Member
Registered: 2018-08-12
Posts: 10

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

For those that are using different locales (LC_MESSAGES in particular), you have to run kbuildsycoca6 with the correct LC_MESSAGES, the one you are running dolphin in.

for context: Basically I have my shell on a different language as the rest of my system for aesthetic reasons. CJK characters just don't look right among monospace latin script

Offline

#17 2024-05-10 12:54:24

cyberpunkrocker
Member
From: Birckala, Finland
Registered: 2019-09-16
Posts: 30
Website

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

I'm starting to think that @fhftsai256's 'hack'

fhftsai256 wrote:
sudo ln -s /etc/xdg/menus/plasma-applications.menu /etc/xdg/menus/applications.menu

may still be a better solution in the long run. Kbuildsycoca6 keeps arbitrarily stopping without any apparent reason and consequently losing the menus, forcing me to restart it manually.

Offline

#18 2024-05-13 14:38:36

Trvzn
Member
Registered: 2023-07-19
Posts: 17

Re: [SOLVED] Weird XDG MIME Behavior with KDE Dolphin on Hyprland

I understand this is marked as solved, but it wasn't clear for me what the solution was. Nonetheless, the following worked for me, so I thought I might add to this thread:
https://www.reddit.com/r/kde/comments/1 … t/l1jinyf/

Last edited by Trvzn (2024-05-13 14:39:06)

Offline

Board footer

Powered by FluxBB