You are not logged in.
Hello everyone, this is my first thread on this forum.
After using KDE for 2 years I decided to switch to i3 and build my own desktop experience.
So far so good, everything seems to be working correctly, except for one thing:
I've decided to use ranger as my file manager, (it's very good and interesting, even if I'm not an experienced Vim user), but it won't open when invoked by any of my graphical programs. Basically, the only way I have to open an instance of ranger is by manually launching the terminal and typing "ranger"; alternatively I can open the dmenu and select "ranger", in that case it will open a terminal instance on its own.
I don't know if this is an expected behaviour but I'd like that any time I click on "Open in file manager" in a graphical menu, ranger will open in order to fulfill the command. I've noticed this behaviour with applications such as Chromium, IntelliJ IDEA (and others which don't come in my head at the moment). What happens instead is just nothing. Is it possibile to achieve that?
Honestly it's kind of annoying because I sometimes need to quickly jump to a specific folder in a file manager when my editor can't manipulate files the way I want.
Here's the version of i3, urxtv and ranger:
$ i3 --version
i3 version 4.14.1 (2017-09-24) © 2009 Michael Stapelberg and contributors
$ urxvt --help
rxvt-unicode (urxvt) v9.22 - released: 2016-01-23
$ ranger --version
ranger version: ranger-stable 1.9.0
Python version: 3.6.4 (default, Jan 5 2018, 02:35:40) [GCC 7.2.1 20171224]
Locale: en_GB.UTF-8Also, ranger is already assigned to the inode/directore MIME type:
$ xdg-mime query default inode/directory
ranger.desktopLast edited by brainplot (2018-02-02 21:17:05)
Offline
is urxvt your only terminal? Many applications rely on GLib/Gio which has a narrow set of terminal names it tries, so a symlink from rxvt may help.
https://bbs.archlinux.org/viewtopic.php … 2#p1750642
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Please post the content of ranger.desktop. Have you configured which terminal emulator should be launched? If not, do you have xterm installed?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I tried the progandy's solution but it didn't work.
As to the Tribly's reply, here's ranger.desktop located in /usr/share/applications/
$ cat /usr/share/applications/ranger.desktop
[Desktop Entry]
Type=Application
Name=ranger
Comment=Launches the ranger file manager
Icon=utilities-terminal
Terminal=true
Exec=ranger
Categories=ConsoleOnly;System;FileTools;FileManager
MimeType=inode/directory;However, I also tried to edit that file and copy it in ~/.local/share/applications/ and now it looks like this
$ cat .local/share/applications/ranger.desktop
[Desktop Entry]
Type=Application
Name=ranger
Comment=Launches the ranger file manager
Icon=utilities-terminal
Terminal=true
Exec=sh -c "$TERMINAL -e ranger"
Categories=ConsoleOnly;System;FileTools;FileManager
MimeType=inode/directory;I've got TERMINAL set to "urxvtc" in order to open the client of the urxvt's daemon since I've demonised it. That's why I put sh -c in front of it, I wasn't sure if desktop files feature variable expansion.
Anyways, it doesn't work either. If I launch ranger using my dmenu it'll work correctly.
EDIT:
I'm also noticing a strange behaviour now. When I click on "Show in folder" in the Downloads tab of Chromium, it'll open another tab to browse my file system instead of opening the terminal window with ranger. The very weird thing is that Intellij IDEA does exactly the same thing: if I click on "show in ranger", as the option says, it'll open an instance of Chromium with the selected folder opened in it
Last edited by brainplot (2018-02-02 22:47:16)
Offline
If I launch ranger using my dmenu it'll work correctly.
How does that work? Do you have a dmenu script that works on .desktop files? If so, the .desktop file is probably correct but the way command line arguments are passed are not. See https://standards.freedesktop.org/deskt … -variables (looks like you'll need a %f)
Offline
looks like you'll need a %f
It doesn't work either. Here's my desktop file now
$ cat .local/share/applications/ranger.desktop
[Desktop Entry]
Type=Application
Name=ranger
Comment=Launches the ranger file manager
Icon=utilities-terminal
Terminal=true
Exec=sh -c "$TERMINAL -e ranger %f"
Categories=ConsoleOnly;System;FileTools;FileManager
MimeType=inode/directory;My browser keeps opening folders ![]()
I've also tried to leave just
Exec=ranger %fbut it doesn't work.
How does that work? Do you have a dmenu script that works on .desktop files?
From the default i3 config file:
# start dmenu (a program launcher)
# bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
bindsym $mod+d exec --no-startup-id i3-dmenu-desktopOffline
Your browser keeps opening them? (are it the folders you tried to open in ranger?) Are your .desktop associations set correctly? Alternatively, try swapping ranger with something like sh - c "echo $* >> /tmp/some_log" and see what you end up with.
EDIT: also:
Field codes must not be used inside a quoted argument, the result of field code expansion inside a quoted argument is undefined.
Last edited by Steef435 (2018-02-02 23:15:50)
Offline
Field codes must not be used inside a quoted argument, the result of field code expansion inside a quoted argument is undefined.
Thank you for pointing it out.
Yes, the folder that gets opened is the right one. It just opens in a tab of my browser.
Also, I'd like to add another program to the list: udiskie does the same thing too. If I click on "Browse /dev/sd<whatever>" it launches a Chromium instance with the folder opened in it.
try swapping ranger with something like sh - c "echo $* >> /tmp/some_log" and see what you end up with
I put that in my desktop file at the Exec key; what I get is that some_log is not even created at all, after trying to open ranger three times from the gui programs
Last edited by brainplot (2018-02-02 23:31:35)
Offline
Note using $TERMINAL in a desktop file will almost certainly not work. Environment variables are not global variables. So it is likely that TERMINAL is empty in the environment in which that command is run. If you want to explicitly have the desktop file start a terminal, just enter the path to your terminal (e.g. "/bin/urxvt -c ranger").
However this doesn't seem to be the issue as your echo command also isn't working.
It sounds like a problem with xdg-open. Unfortunately that's always a bit of a non-deterministic black box in my view.
Have you tried (from a terminal) directly calling xdg-open on a directory?
Last edited by Trilby (2018-02-02 23:41:57)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I've already showed the output of querying the default program for directories and ranger seems to be configured to handle those.
Is there a way to get all the MIME types associated to a specific program?
I just tried
$ xdg-open .localand it works. It opens ranger at the given directory.
Still not working for gui apps though
Last edited by brainplot (2018-02-03 00:09:00)
Offline
I ended up uninstalling ranger and installing PCManFM. I'm liking it and all the GUI programs open it correctly.
At this point I think that it must be something related to ranger.
Offline