TransWikia.com

Use ranger as my default file manager in i3wm

Unix & Linux Asked by SLN on December 4, 2020

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

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 ranger.desktop inode/directory # sets ~/.config/mimeapps.list

Answered by laktak on December 4, 2020

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.

Answered by bilabila on December 4, 2020

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.

Answered by Try431 on December 4, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP