0

I have set default file manager to ranger (xdg-mime query default inode/directory = ranger.desktop). Yet, when I am not in the terminal already, xdg-open / opens in the browser.

I have checked in /usr/share/applications/ranger.desktop is Terminal=true. Setting TERM=foot (my terminal) in /etc/environment did not help, neither did linking my terminal to /bin/xterm.

1 Answer 1

0

xdg-open will use the default handler open_generic() function if your desktop environment cannot be detected or is not supported. The default handler does not support the terminal well and would resort to using your default browser to open the url.

The gio open command from glib2 can be used instead, as it has better terminal support.

There are also other alternatives to xdg-open, most of which replace /usr/bin/xdg-open

10
  • what do I do with the gio open? I cannot change how some gui app decides to open a dir.
    – JosefLitos
    Jul 2, 2023 at 14:58
  • what is your DE?
    – memchr
    Jul 2, 2023 at 15:01
  • sway (wayland) - window manager To be clear, I know I can solve it by creating a custom .desktop with Terminal=false but I wanted a better solution, not worse
    – JosefLitos
    Jul 2, 2023 at 15:02
  • How do you use xdg-open, is it called from other programs?
    – memchr
    Jul 2, 2023 at 15:05
  • I use a gtk app and it opens a directory. Idk how, I just know xdg-open can be used from the terminal to act the same. So I launch it from rofi (gui program launcher) and there it opens the browser just as all other gui apps. But when used in terminal already, it works fine.
    – JosefLitos
    Jul 2, 2023 at 15:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .