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:
- Set
/home/ertecturing/.scripts/Ranger_Default_File_Manager.sh "%s"
as default file manager in xfce settings - 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. - 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 commandecho $@ | 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.
CodePudding user response:
Changing your OUT
variable to the command that you say works may be a better approach.
OUT=$(echo "$@" | sed 's|$|/|g')
CodePudding user response:
Additional Solution for Spaces:
OUT=$(echo "$@" | sed "s:///:////:g" | sed "s/ / /g")
xfce4-terminal -T "Ranger File Manager" -x ranger "$OUT"