The bash script that uses ROFI is:

xdg-open "$(locate home | rofi threads 0 -dmenu -i -p "locate:")"

This works fine from URXVT (command line), but when I bind this to a key and open ROFI, Every thing works (for example the directory opens in thunar) except when I try to open a text file like .Xdefault

I have already checked my mime settings and it works, because the file opens fine with nano using mimeopen and xdg-open.

Something happens in the background, because when I exit out of I3, I see the file open in nano along with some gibberish. I can X out of nano to get to the bash prompt.

Normally I don't ask questions, but I am not even sure how to check for a solution. please let me know how this can be fixed.

Edit: Just be clear when I open the same text file in I3 using xdg-open it opens it in nano (in the same urxvt terminal). "xdg-mime query default text/plain" returns "nano.desktop"

  • ' xdg-mime query default text/plain' returns nano.desktop Jun 10, 2017 at 16:26
  • I also have a nano.desktop entry and I updated my mime database with update-mime-database Jun 10, 2017 at 16:36
  • is it possible to open a new terminal with xdg-open Jun 10, 2017 at 17:52
  • sorry, I had mentioned I could open the file using mimeopen but there is an error "can't exec "x-term": no such file or directory Jun 10, 2017 at 18:17
  • 1
    Still don't understand why it needs a XTERM when it should open it in urxvt (btw i replaced xdg-open with mimeopen) Jun 10, 2017 at 18:56

2 Answers 2


There is no mime-type associated with a command-string, so xdg-open runs the shell command in the parent terminal (outside i3) rather than opening a terminal to run the command.

You can work around this limitation by making a ".desktop" file to launch the command as suggested in Set default xdg-open application to terminal program


I was able to find a temp fix by installing xterm and have the text files open in xterm using nano. However I do not understand why it does not use URXVT and nano to do the same thing

You must log in to answer this question.

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