简体   繁体   中英

How to set ranger as default file manager

Related: Here , Here , Here , & Here .

I want to be able to use gui applications with ranger, eg, I want to click a desktop folder icon & have it open in ranger.

Steps I take & errors that follow:

  1. Set /home/ertecturing/.scripts/Ranger_Default_File_Manager.sh "%s" as default file manager in xfce settings
  2. Ranger_Default_File_Manager.sh runs xfce4-terminal -T "Ranger File Manager" -x ranger $@ This commands almost works, but it creates a directory error because directories given by $@ always start with only file:/// not file://// like they need to in order to function.
  3. I tried to add the missing 4th slash with this sed command someone shared with me: OUT=$(sed -e 's/\/\/\//\/\/\/\//g' $1) xfce4-terminal -T "Ranger File Manager" -x ranger $OUT I have little idea whether that first line's syntax is correct. The first line only produces blank output, but if I test a similar command echo $@ | sed "s/\/\/\//\/\/\/\//g" >> ~/Desktop/file echo $@ | sed "s/\/\/\//\/\/\/\//g" >> ~/Desktop/file it always outputs the 4th slash I'm looking for.

Does anyone know a way to solve this issue? Help is highly appreciated.

Changing your OUT variable to the command that you say works may be a better approach.

OUT=$(echo "$@" | sed 's|$|/|g')

Final Solution:

OUT=$(echo "$@" | sed "s/\/\/\//\/\/\/\//g") xfce4-terminal -T "Ranger File Manager" -x ranger $OUT

  • xfce default application calls on this^ script as default file manager

Thanks to @HatLess

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM