You are not logged in.

#1 2026-05-13 15:19:41

mango56
Member
Registered: 2026-05-13
Posts: 5

[SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

Hello,

I recently installed Arch using the wiki install guide and for the most part I've been able to troubleshoot everything. My one issue has been file choosers in applications not launching. I'm using i3 as my window manager, and Dolphin as my file manager. I also have KDE Plasma installed as another desktop environment, but I don't use them in conjunction. 

I checked the status of the xdg-desktop-portal-gtk service using systemctl, confirming that the applications are attempting to run XDG.

$ systemctl --user status xdg-desktop-portal-gtk.service

× xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-gtk.service; static)
     Active: failed (Result: exit-code) since Wed 2026-05-13 11:01:43 EDT; 16s ago
Invocation: 97f8f5153ee048b9a7e7e7631d521293
    Process: 2592 ExecStart=/usr/lib/xdg-desktop-portal-gtk (code=exited, status=1/FAILURE)
   Main PID: 2592 (code=exited, status=1/FAILURE)
   Mem peak: 2.7M
        CPU: 54ms

May 13 11:01:43 archjuno systemd[1647]: Starting Portal service (GTK/GNOME implementation)...
May 13 11:01:43 archjuno xdg-desktop-portal-gtk[2592]: cannot open display:
May 13 11:01:43 archjuno systemd[1647]: xdg-desktop-portal-gtk.service: Main process exited, code=exited, status=1/FAILURE
May 13 11:01:43 archjuno systemd[1647]: xdg-desktop-portal-gtk.service: Failed with result 'exit-code'.
May 13 11:01:43 archjuno systemd[1647]: Failed to start Portal service (GTK/GNOME implementation).

I've attempted to reinstall i3 and xdg, to no avail. I've also tried some suggestions to people experiencing similar issues, but those fixes haven't worked. Any suggestions would be greatly appreciated.

Thanks,
Mango

Last edited by mango56 (2026-05-14 20:43:52)

Offline

#2 2026-05-13 15:28:27

SimonJ
Member
From: Spain
Registered: 2021-05-11
Posts: 322
Website

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

I use niri and the config file can have an effect also

~> cat .config/xdg-desktop-portal/portals.conf 
[preferred]
default=gtk
org.freedesktop.portal.ScreenCast=wlr
org.freedesktop.portal.Screenshot=wlr

You will need to adapt to your wm and installed portals.

pacman -Ss xdg-desktop-portal | grep installed
extra/xdg-desktop-portal 1.20.4-1 [installed]
extra/xdg-desktop-portal-gtk 1.15.3-1 [installed]
extra/xdg-desktop-portal-wlr 0.8.2-1 [installed]

I don't know if this is your problem but I have had real issues getting it all to work, and this is the settings that do.


Rlu: 222126

Offline

#3 2026-05-13 15:44:46

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,205

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

How are you starting i3? If via .xinitrc you need to make sure you've seen and applied the second note in https://wiki.archlinux.org/title/Xinit#xinitrc so a script gets sourced that sets up the DISPLAY environment variable within your user session context.

Offline

#4 2026-05-13 16:29:58

mango56
Member
Registered: 2026-05-13
Posts: 5

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

In response to SimonJ:

Apparently I never made a config file for my desktop portal, thank you for pointing that out. Should I create one, or is a default already referenced?

In response to V1del:
I am starting i3 via .xinitrc, and there is indeed a start file that references the 50-system-user.sh file that sets the DISPLAY env var.

#!/bin/sh
#  SPDX-License-Identifier: LGPL-2.1-or-later
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

systemctl --user import-environment DISPLAY ${XAUTHORITY+XAUTHORITY}

if command -v dbus-update-activation-environment >/dev/null 2>&1; then
    dbus-update-activation-environment DISPLAY XAUTHORITY
fi

Also I just realized that I'm not experiencing this issue when using Konsole to save files. For reference I was trying to open the file picker in vscodium and librewolf. Could my issue be related to my KDM environment?

Offline

#5 2026-05-13 19:37:28

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,725

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

Please don't paraphrase, https://bbs.archlinux.org/viewtopic.php?id=57855 - in doubt post the xinitrc

May 13 11:01:43 archjuno xdg-desktop-portal-gtk[2592]: cannot open display:

means the process cannot see the $DISPLAY environment what should™ not be the case if the environment is properly imported into the session.

Offline

#6 2026-05-14 04:11:34

mango56
Member
Registered: 2026-05-13
Posts: 5

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

Sorry for the paraphrasing, here's the full xinitrc script.

#!/bin/sh

prefix="/usr"
exec_prefix="${prefix}"
xrdb="xrdb"
xinitdir="/etc/X11/xinit"
xclock="xclock"
xterm="xterm"
twm="twm"
xmodmap="xmodmap"

userresources="$HOME/.Xresources"
usermodmap="$HOME/.Xmodmap"
sysresources="$xinitdir/.Xresources"
sysmodmap="$xinitdir/.Xmodmap"

# merge in defaults and keymaps

if [ -f "$sysresources" ]; then
    if [ -x /usr/bin/cpp ] ; then
        "$xrdb" -merge "$sysresources"
    else
        "$xrdb" -nocpp -merge "$sysresources"
    fi
fi

if [ -f "$sysmodmap" ]; then
    "$xmodmap" "$sysmodmap"
fi

if [ -f "$userresources" ]; then
    if [ -x /usr/bin/cpp ] ; then
        "$xrdb" -merge "$userresources"
    else
        "$xrdb" -nocpp -merge "$userresources"
    fi
fi

if [ -f "$usermodmap" ]; then
    "$xmodmap" "$usermodmap"
fi

# start some nice programs

if [ -d "$xinitdir"/xinitrc.d ] ; then
        for f in "$xinitdir/xinitrc.d"/?*.sh ; do
                [ -x "$f" ] && . "$f"
        done
        unset f
fi

"$twm" &
"$xclock" -geometry 50x50-1+1 &
"$xterm" -geometry 80x50+494+51 &
"$xterm" -geometry 80x20+494-0 &
exec "$xterm" -geometry 80x66+0+0 -name login

As a side note, xdg-open works correctly. Right now I'm mostly confused as to how to set the $DESKTOP variable to be suitable for operation with i3.

Last edited by mango56 (2026-05-14 04:27:37)

Offline

#7 2026-05-14 07:47:09

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,725

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

That's the standard xinitrc and would start twm

suitable for operation with i3

loginctl session-status

Iff you're using startx/xinit the relevant file would be ~/.xinitrc

Offline

#8 2026-05-14 20:47:21

mango56
Member
Registered: 2026-05-13
Posts: 5

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

Managed to fix it by adding,

exec systemctl --user import-environment DISPLAY XAUTHORITY
exec dbus-update-activation-environment --systemd DISPLAY XAUTHORITY

to my i3 config file. Thanks for the help everyone.

Offline

#9 2026-05-14 20:52:27

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,725

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

Out of curiosity (and for the benefit of future readers), how do you actually start i3 w/o importing the environment into the session if it's not via xinit/startx?
wisdom_of_the_ancients.png

Offline

#10 2026-05-14 21:12:38

mango56
Member
Registered: 2026-05-13
Posts: 5

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

To be honest, I'm as confused as you are. I use tuigreet/greetd to select my session if that's relevant information. I'm gonna do more research into the stack, and update the thread once I do. I have a feeling that it's an issue stemming from my messy install/configuration process.

Offline

#11 2026-05-14 21:34:07

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,725

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

seth wrote:
loginctl session-status

Iff you're using startx/xinit the relevant file would be ~/.xinitrc

Offline

#12 2026-05-21 07:47:07

neoire
Member
Registered: 2015-08-07
Posts: 9

Re: [SOLVED] Can't open file chooser *xdg-desktop-portal-gtk: cannot open*

Had exact same problem on xdm + i3, fixing xinitrc (xsession in my case) worked, thank you seth.

Had no idea what portals were before this (learned something new), all I had to go on was this cryptic error in Chrome and Slack logs:

Request ended (non-user cancelled).

Took some detours to pin-point the core issue. Leaving this message, hopefully can save the next person some time.

Last edited by neoire (2026-05-21 07:50:44)

Offline

Board footer

Powered by FluxBB