You are not logged in.

#1 2017-11-22 13:26:50

momu
Member
Registered: 2017-10-14
Posts: 137

[SOLVED] Default terminal emulator in i3wm

How can I make urxvt my default terminal emulator in i3? This is the problem I have: when I download something and I click "Open Containing Folder" in Firefox, Firefox opens ranger in uxterm but not in urxvt. i3-sensible-terminal is urxvt, which I verified by running

i3-msg exec i3-sensible-terminal

and getting urxvt to pop up. Also, running firefox in terminal, then clicking "Open Containing Folder" shows message

(firefox:6915): GLib-GIO-WARNING **: couldn't find a terminal, falling back to xterm

I posted this same question on superuser: How to make firefox open CLI apps in specified terminal. You can click link to see messages I had there, it might help diagnose and solve the problem.

Last edited by momu (2017-11-22 14:22:45)

Offline

#2 2017-11-22 14:04:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Default terminal emulator in i3wm

This has nothing at all to do with i3.  You need to configure firefox and/or the tools it uses.  Firefox does not require i3.  Firefox doesn't even need a window manager to be running.  I suspect it uses xdg-open or related tools - but in any case, redirect your search to firefox configuration, not i3.

EDIT: for clarity, this is *downstream* of firefox.  "Open containing folder" requests a filemanager (probably via xdg-open) - and you have configured this to mean ranger in a terminal.  Just the same, this has nothing to do with your WM.

EDIT: I just read your link.  "Towo" should be more confident: despite appologizing for an irrelevant question, his was the only one even remotely on track.  Firefox is pointed to "ranger.desktop" to open the folder.  So the problem is in the ranger.desktop file and or the tools it uses to determine which terminal to use (which goes back again to xdg-open).

Last edited by Trilby (2017-11-22 14:11:37)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2017-11-22 14:22:14

momu
Member
Registered: 2017-10-14
Posts: 137

Re: [SOLVED] Default terminal emulator in i3wm

Modifying /usr/share/applications/ranger.desktop so Terminal is set to false and Exec is equal to urxvt -e ranger solves the problem.

[Desktop Entry]
Type=Application
Name=ranger
Comment=Launches the ranger file manager
Icon=utilities-terminal
Terminal=false
Exec=urxvt -e ranger
Categories=ConsoleOnly;System;FileTools;FileManager
MimeType=inode/directory;

Offline

#4 2017-11-22 14:22:17

progandy
Member
Registered: 2012-05-17
Posts: 5,266

Re: [SOLVED] Default terminal emulator in i3wm

You could have tried to read the manpage for i3-sensible-terminal, or you could directly replace the call with your terminal
https://manned.org/i3-sensible-terminal.1

Edit: Sorry, somehow i misread that. I first thought you wanted urxvt, but i3 started uxterm, but that is not the case at all.

Last edited by progandy (2017-11-22 14:28:15)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#5 2017-11-22 14:24:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Default terminal emulator in i3wm

Progandy, that answers the question in the title, but not the question he was actually asking.  xdg-open does not call i3-sensible-terminal (as xdg-open also doesn't depend on i3!)  i3wm is not relevant to the actual question.

Momu, editting the desktop file as you have is a very good workaround, but you should edit a copy in ~/.local/shareapplications otherwise your change will just be overwritten on the next update of ranger.  I honestly haven't the foggiest idea how to get the xdg-open related tools to work in sane ways which is why I just completely avoid or replace them.

Last edited by Trilby (2017-11-22 14:26:53)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2017-11-22 14:26:39

momu
Member
Registered: 2017-10-14
Posts: 137

Re: [SOLVED] Default terminal emulator in i3wm

Trilby wrote:

Progandy, that answers the question in the title, but not the question he was actually asking.  xdg-open does not call i3-sensible-terminal (as xdg-open also doesn't depend on i3!)

Momu, editting the desktop file as you have is a very good workaround.  I honestly haven't the foggiest idea how to get the xdg-open related tools to work in sane ways which is why I just completely avoid or replace them.

Me too. I know this is not the real solution, but it will serve my needs.

Offline

#7 2017-11-22 14:37:46

progandy
Member
Registered: 2012-05-17
Posts: 5,266

Re: [SOLVED] Default terminal emulator in i3wm

AFAIK firefox uses GLib/GIo to launch the desktop file. It tries the terminals in this order. I suggest you create a symlink from rxvt to urxvt somewhere in your path. (I have ~/bin added to my path)

# source: https://github.com/GNOME/glib/blob/master/gio/gdesktopappinfo.c
gnome-terminal -x
nxterm -e
color-xterm -e
rxvt -e
dtterm -e
xterm -e 

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#8 2017-11-22 14:40:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Default terminal emulator in i3wm

That's hardcoded into it?  That's horrible. (edit: yes, I confirmed it is hardcoded in, and yes that is horrible).

Last edited by Trilby (2017-11-22 14:42:52)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2017-11-22 14:51:41

progandy
Member
Registered: 2012-05-17
Posts: 5,266

Re: [SOLVED] Default terminal emulator in i3wm

Trilby wrote:

That's hardcoded into it?  That's horrible. (edit: yes, I confirmed it is hardcoded in, and yes that is horrible).

xdg-open is not much better. It assumes it is run in a terminal and never even checks if it has to start one. So it probably is best to hardcode your terminal in desktop files and remove Terminal=true.

Last edited by progandy (2017-11-22 14:54:33)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#10 2017-11-22 14:55:18

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Default terminal emulator in i3wm

Ah no wonder I couldn't find any relevant documentation (*headdesk* so much bad software).


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2017-11-22 21:29:14

momu
Member
Registered: 2017-10-14
Posts: 137

Re: [SOLVED] Default terminal emulator in i3wm

Here I wrote the solution, step by step: solution.

Offline

#12 2017-11-22 22:53:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] Default terminal emulator in i3wm

FWIW, there is no need for sudo in the first step.  If you get rid of sudo there, all of step 2 is irrelevant.  Further there is no point in two seds (which as you use the -i flag each create new copies of the file temporarily).  In fact if you are using sed anyways, there is no need for cp (instead of copying the file and having sed make a new copy of the file which is then moved over the first copy, just sed once):

sed '/^Terminal=/d;s/^Exec=/Exec=urxvt -e /' /usr/share/applications/ranger.desktop > ~/.local/share/applications/ranger.desktop

One step.  No copies.

Your version makes a copy, chmods and chgroups the copy, uses sed to make a new version and move it over the first copy, then sed again to make yet another version and move it over the previous one yet again.

Last edited by Trilby (2017-11-22 22:57:39)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB