3

When download a file via browser, the download status message box has an option named show in folder, How can I configure it to open ranger when I click it?

Reason I want to do it:

I'm currently using i3wm over Ubuntu, my web browser is Google Chrome, every time when I click this option on the downloaded file my screen will blocked by a blank pane and I can't do anything but reboot the my pc to get things back. I have no idea why is that. Dose i3wm does not have any gui file manager shipped with ?

3 Answers 3

4

The show in folder in chromium's download page is just calling xdg-open dir, you can read Default_applications.

A working(chromium, ranger, i3wm) example using custom xdg-open modified from linopen, and its config

i3wm is just a window manager, you can use any gui file manager like thunar, pcmanfm. See File_managers for more.

2

From reading your question, it sounds somewhat similar to Nautilus bringing up a desktop window that can't be clicked on and seems to have nothing inside.

Try running gsettings set org.gnome.desktop.background show-desktop-icons false in your terminal, and see if that blank screen still shows up.

This doesn't address your desire to have ranger be the primary file manager, though this AskUbuntu question does seem to be relevant.

2

First create open-tui (and set chmod +x on it):

#!/bin/bash
tool=$1
loc="$2"
loc=${loc#"file://"}

if [[ ! -e $loc ]]; then
    loc=$(dirname "$loc")
fi

i3-msg exec 'urxvt -e '$tool' "'$loc'"'

You need to modify i3-msg if you are using Gnome or something else rather than i3wm.

Finally create a ~/.local/share/applications/xranger.desktop file to register ranger as a desktop app:

[Desktop Entry]
Version=1.0
Name=xranger
GenericName=File Manager
Comment=Launches the ranger file manager
# needs full path to bin
Exec=/home/path-to/open-tui ranger %F
Icon=utilities-terminal
Terminal=false
X-MultipleArgs=false
Type=Application
MimeType=inode/directory;
StartupNotify=true
Categories=System;FileTools;FileManager

I used xranger instead of ranger to avoid conflicts with the default desktop item that may have been installed by ranger.

Then in your GUI use the new desktop link or set the default handler for directories to ranger:

xdg-mime default xranger.desktop inode/directory # sets ~/.config/mimeapps.list
2
  • it should be xdg-mime default xranger.desktop inode/directory right? xranger instead of ranger.
    – Akhil
    Commented Aug 16, 2021 at 10:12
  • @Akhil yes, thanks - fixed.
    – laktak
    Commented Aug 16, 2021 at 22:11

You must log in to answer this question.

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