shellsedsyntaxfile-managerr-ranger

How to set ranger as default file manager


Related: Here, Here, Here, & Here.

I want to be able to use gui applications with ranger, e.g., 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 it always outputs the 4th slash I'm looking for.

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


Solution

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

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