Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by
edited by

Hi
I'm having an issue using vifm as default, with vifm setted as default

On ~/.config/mimeapps.list:

inode/direcory=vifm.desktop
inode/mount/point=vifm.desktop

I have this script for open files & folders:

find ~ | fzf | xargs -r -0 xdg-open

It doesn't work opening folders vifm
If I write it like this

xdg-open $(find ~ | fzf | xargs -r -0)

It works, but the variable -0 of xargs doesn't , so the script is unusable, because it doesn't works with files and folders with spacing in their names.

Any suggestion?

Thanks in advance

by

Mind that the e-mail notification about my answer was rejected by your e-mail server due to blacklisted IP of the outgoing e-mail server. Maybe notification about the comment will go through.

1 Answer

+1 vote
by

Hi,

I think this happens because xargs doesn't let xdg-open detect that terminal is open. If you're openning a single directory, adding quotes should be enough to fix escaping issue:

xdg-open "$(find ~ | fzf)"
by

I solved by adding the -o variable to xargs

find ~ | fzf | xargs -r -0 -o xdg-open

Now I have another problem.
If I use rofi or dmenu, the script works only as root user

find ~ | rofi -dmenu -i | xargs -r -0 xdg-open

Or

xdg-open "$(find ~ | rofi -dmenu -i)"

by

Is there an error message? Does dmenu/rofi work but Vifm isn't run?

by

With sudo rights, it opens vifm

As normal user, it opens Firefox instead (dunno why)

Running the bash script in a terminal work
cd ~/.bin
./script.sh

Running the script with a keybind assigned doesn't work
Using a keybind didn't give any output, o course

by

See https://unix.stackexchange.com/a/590093, xdg-open doesn't start a terminal (bug). You might have to copy vifm.desktop to ~/.local/share/applications and edit it as a workaround.

by

Hi
I fixed the issue as you suggested (it's pretty much a workaround)

Another question

Since running the script as root worked, can changing the owner of /usr/share/applications folder can solve the issue as well in your opinion?

by

Hi
Another solution
Is to not using xdg-open

I tried handle instead, it works better and it recognize terminal application in the right way

handlr open $(find ~ | rofi -dmenu -i |)

https://github.com/chmln/handlr

by

Since running the script as root worked, can changing the owner of /usr/share/applications folder can solve the issue as well in your opinion?

I don't think it's directory permissions issues. Not sure why running as root changes anything.

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.
...