My system is Debian 12. I try to use xdg-open
to open an image file, yet it blocks when the image file is opened. The image viewer has to be closed before xdg-open
returns.
While many people state that xdg-open
returns immediately in their environment. I wonder whether this is a configuration or distribution issue. If possible, is there any option to let xdg-open detach and return immediately. I searched the xdg-open
document yet didn’t find anything.
2
Answers
try to install/reinstall the package
xdg-utils
:If this one doesn’t work, try:
If that doesn’t work, try to update your packages:
xdg-open
is just a wrapper to open a file with an application that can handle it.As such, it doesn’t make any guarantees about whether it will block or return immediately: this is up to the delegated application (so if
xdg-open
ends up callingdisplay-im6.q16
, then it isdisplay-im6.q16
that is blocking (or not).Of course things are a bit more complicated.
E.g. if i run
xdg-open file.jpg
then i also getdisplay-im6.q16
, but without blocking. Why? Because i have also installed theexo-utils
, soxdg-open
does not calldisplay-im6.q16
directly, but instead callsexo-open
which (for whatever reasons) does not block.Now, i haven’t found any documentation that guarantees that
exo-open
will not block.If you want to
xdg-open
to return immediately, just background it:If you don’t want to remember having to do this, you could also create an excutable file
/usr/local/bin/xdg-open
which (depending on yourPATH
) should take precedence over the system installed/usr/bin/xdg-open
:Or install some lightweight (at least I think it is lightweight) middleware like
exo-utils