Using xdg-open to open file make dolphin opened first

Hi all, I got problem opening any file from eg: chrome, which called xdg-open to open specified file. It called out dolphin first and then used dolphin to handle the opening of file. And after opened the file, dolphin was left there and had to be closed manually. How to open the file directly or handle the opening of file through dolphin and closed automatically after opening the file?

Here is my system info gethered using inxi -bI:

System:
  Host: openSUSE Kernel: 6.6.6-1-default arch: x86_64 bits: 64
    Desktop: KDE Plasma v: 5.27.10 Distro: openSUSE Tumbleweed 20231214
Machine:
  Type: Laptop System: HP product: OMEN by HP Laptop 16-b0xxx v: N/A
    serial: <superuser required>
  Mobo: HP model: 88F5 v: 86.39 serial: <superuser required> UEFI: AMI
    v: F.26 date: 01/28/2022
Battery:
  ID-1: BAT0 charge: 66.0 Wh (100.0%) condition: 66.0/70.1 Wh (94.2%)
CPU:
  Info: 6-core 11th Gen Intel Core i5-11400H [MT MCP] speed (MHz): avg: 865
    min/max: 800/4500
Graphics:
  Device-1: Intel TigerLake-H GT1 [UHD Graphics] driver: i915 v: kernel
  Device-2: NVIDIA GA107M [GeForce RTX 3050 Ti Mobile] driver: nvidia
    v: 545.29.06
  Device-3: Luxvisions Innotech HP Wide Vision HD Camera driver: uvcvideo
    type: USB
  Display: x11 server: X.Org v: 21.1.9 with: Xwayland v: 23.2.2 driver: X:
    loaded: modesetting,nvidia unloaded: fbdev,vesa dri: iris
    gpu: i915,nvidia,nvidia-nvswitch resolution: 1: 1920x1080 2: N/A
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 545.29.06
    renderer: NVIDIA GeForce RTX 3050 Ti Laptop GPU/PCIe/SSE2
Network:
  Device-1: Intel Tiger Lake PCH CNVi WiFi driver: iwlwifi
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    driver: r8169
Drives:
  Local Storage: total: 3.24 TiB used: 590.2 GiB (17.8%)
Info:
  Processes: 370 Uptime: 8h 52m Memory: total: 16 GiB note: est.
  available: 15.27 GiB used: 4.59 GiB (30.1%) Shell: fish inxi: 3.3.31

I tired to track what xdg-open does and found that it handles the input to kde-open to open these files.

 ❯ xdg-open ~/2023-02-13-23-01.png
+ check_common_commands /home/ddqi/2023-02-13-23-01.png
+ '[' 1 -gt 0 ']'
+ parm=/home/ddqi/2023-02-13-23-01.png
+ shift
+ case "$parm" in
+ '[' 0 -gt 0 ']'
+ '[' -z '' ']'
+ unset XDG_UTILS_DEBUG_LEVEL
+ '[' 0 -lt 1 ']'
+ xdg_redirect_output=' > /dev/null 2> /dev/null'
+ '[' x/home/ddqi/2023-02-13-23-01.png '!=' x ']'
+ url=
+ '[' 1 -gt 0 ']'
+ parm=/home/ddqi/2023-02-13-23-01.png
+ shift
+ case "$parm" in
+ '[' -n '' ']'
+ url=/home/ddqi/2023-02-13-23-01.png
+ '[' 0 -gt 0 ']'
+ '[' -z /home/ddqi/2023-02-13-23-01.png ']'
+ detectDE
+ unset GREP_OPTIONS
+ '[' -n KDE ']'
+ case "${XDG_CURRENT_DESKTOP}" in
+ DE=kde
+ '[' xkde = x ']'
+ '[' xkde = x ']'
+ '[' xkde = x ']'
+ '[' xkde = xgnome ']'
+ '[' -f /run/user/1000/flatpak-info ']'
+ '[' xkde = x ']'
+ DEBUG 2 'Selected DE kde'
+ '[' -z '' ']'
+ return 0
+ case "${BROWSER}" in
+ case "$DE" in
+ open_kde /home/ddqi/2023-02-13-23-01.png
+ '[' -n 5 ']'
+ case "${KDE_SESSION_VERSION}" in
+ kde-open5 /home/ddqi/2023-02-13-23-01.png
+ '[' 0 -eq 0 ']'
+ exit_success
+ '[' 0 -gt 0 ']'
+ exit 0

So this behavior is actually as expected?

I finally managed to solve this… The following are steps to find solutions:

  1. The file handler is related to mime type under ~/.config/mimeapps.list. So create a new user to recur this problem may help.
  2. Create a new user. Create sample files. And open them with kde-open.
  3. kde-open gave out errors:
kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found
  1. So x-scheme-handler/file must be set , which is the problem.

And I found these lines in mimeapps.list. After remove theses lines things are finally normal.

1 Like