Alter Behavior of xdg-open

linux, terminal, xdgutils

Solution

First one is easy. Just

alias xdg-open="xdg-open 2>/dev/null"

If you want it permanently, just add that line to ~/.bashrc file.

I recommend you to think twice if you want to become blind to errors, though.

The second one is quite confusing to me. xdg-open shouldn't be intereactive. In my computer (Debian sid) xdg-open execs the command and ends, even if the command itself has not ended (ie: you have not closed the application opened for the URL). I think this should be the behaviour of xdg-open on any platform (it's supposed to work exactly the same way on any XDG system, that's its very purpose).

Anyway, for any command you launch in a shell, if you want it to be non-interactive, that is, to allow to enter commands even if the previous one hasn't finished, you just attach "&" to the end of it. Example:

# prompt is not shown until you close the calculator
$ gnome-calculator
# prompt is shown right after opening calculator and you can 
# work on the shell even if you don't close it
$ gnome-calculator &

Problem

I use the command xdg-open quite a lot in my Ubuntu Linux terminal. However, two things irk me: Is it possible to suppress the error messages? Is it possible to get the command to always complete? (That is, not continue running, so that I have another "new line" in my terminal). I realize 2 may not be possible, because of the way the program works, but I imagine 1 is.

Original source