3

I have two terminals: uxterm and urxvt. I also use ranger as my file browser. Whenever I select Open Containing Folder in Firefox Downloads, Firefox opens ranger in uxterm. How to make Firefox open ranger in urxvt instead of in uxterm without removing uxterm?

If I have installed another File Manager (I tried Thunar and PCManFM) Firefox automatically chooses them.

I also tried setting $TERM and $TERMINAL to urxvt and rxvt-unicode-256color but there is no difference.

I am running Arch Linux.

  • Change /etc/alternatives/x-terminal-emulator. – Ipor Sircer Nov 21 '17 at 13:10
  • You should probably add which distribution you are running, as implementation of that may depend on the distribution. - For example, @IporSircer's reply is only valid on Ubuntu and Debian. – towo Nov 21 '17 at 13:10
  • post is updated – Hanlon Nov 21 '17 at 13:15
  • Starting firefox from terminal and then clicking on "Open Containing Folder" in Downloads shows message: (firefox:6915): GLib-GIO-WARNING **: couldn't find a terminal, falling back to xterm – Hanlon Nov 22 '17 at 10:10
2

Here is how I solved this problem:

  1. Copy the system ranger.desktop file to local folder.

    $ sudo cp /usr/share/applications/ranger.desktop ~/.local/share/applications
    
  2. Change owner and group.

    $ sudo chown $USER ~/.local/share/applications/ranger.desktop && chgrp 
    $USER ~/.local/share/applications/ranger.desktop
    
  3. Change Terminal to false and Exec to urxvt -e ranger

    $ sed -i 's/Terminal=true/Terminal=false/g' 
    ~/.local/share/applications/ranger.desktop && sed -i 
    's/Exec=ranger/Exec=urxvt -e ranger/g' 
    ~/.local/share/applications/ranger.desktop
    
  4. Update desktop database

    $ update-desktop-database ~/.local/share/applications
    
| improve this answer | |
1

So here the terminal emulator comes from your Desktop Environment, probably GNOME. Just set your default there (go to the overview and look for 'Default Applications').

With non-DE WMs, you need to look up what your WM does. In the case of i3, it uses the i3-sensible-terminal wrapper.

Since you used the $TERMINAL variable: did you set it in .xinitrc or whatever you used to start the i3.

For background, /usr/share/applications/ranger.desktop only says Terminal=true and lets the Desktop Environment figure out which terminal to use.

| improve this answer | |
  • I don't have DE. – Hanlon Nov 21 '17 at 13:32
  • Okay, so what does xdg-mime query default inode/directory return? – towo Nov 21 '17 at 13:34
  • ranger.desktop – Hanlon Nov 21 '17 at 13:35
  • My bad, that was a stupid question. What WM are you running? And do you have some kind of settings daemon (i.e. gnome-settings-daemon) active? – towo Nov 21 '17 at 13:43
  • i3wm. No, systemctl list-units doesn't show anything containing "settings" or "preferences". – Hanlon Nov 21 '17 at 13:46
0

Unfortunately, Firefox uses Gio which check for the existence of several specific terminals in $PATH. See this:

https://gitlab.gnome.org/GNOME/glib/blob/2.21.6/gio/gdesktopappinfo.c#L773

As you can read, rxvt-unicode-256color and $TERMINAL are not checked. Hence the solution, is to create an executable named (e.g) rxvt and make sure Firefox finds it in his $PATH.

You can find out Firefox' $PATH via

grep -z '^PATH=' /proc/$(pidof -s firefox)/environ | tr ':' '\n'

Run this command while Firefox is running. Usually, /usr/local/bin is gonna be printed there, but not any PATH you add in your shell startup files (i.e .bashrc).

For example, here's a command that makes termite available as rxvt in $PATH:

sudo ln -s $(which termite) /usr/local/bin/rxvt

Change termite with the terminal of your choice.

The idea is, that when Firefox is searching for one of the executables it is aware of, (the executables in the switch case here), it will find an executable rxvt in it's $PATH and it won't know it's actually a symlink to termite.

Credit: https://bbs.archlinux.org/viewtopic.php?pid=1750642#p1750642

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.