lf: by default, xdg-open shouldn't be called asynchronously
For example, I had my xdg-open configured to use a terminal audio player for audio files; this worked fine on ranger.
However, on lf with the default config, whem pressing l on a music file, the music would play, but I would still be navigating the folder. It took me a while to figure out that the default is to fork xdg-open, so the audio player’s command-line controls weren’t even accessible.
I ended up configuring cmd open $xdg-open "$f", which I think should be the default. It’s always possible for xdg-open to decide when or not to fork when opening certain files. For example, I’ve told mine to not fork when opening text and audio files, as those happen in the same terminal, but all others fork into a graphical window.
The other silly thing is that the fork cases worked normally, but essentially there were two forks taking place. A bit unnecessary 😃
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (16 by maintainers)
Well then this is exactly the dilemma faced by terminal file managers and no other programs face.
xdg-openis meant for graphical programs and therefor in our case it (should) open any media files comfortably thanks to the command line optionsmpv.desktophas.In comparison, running
xdg-open file.txtopensfile.txtin a new terminal / GUI editor’s new window - as you’d expect if you had used a graphical file manager. This is usually not desired when using a terminal file browser and that’s why you’d probably want to useewhen hovering a text file you’d want to use the same terminal to edit / view it.Ranger’s
riflekind of solves this dilemma specifically for terminal file mangers by essentially re-implementing most ofxdg-openin Python and using a single configuration file. With rifle you can declare that for example:text/*files will be openned by$EDITORin the current terminalapplication/media-whateverwill be openned withmpv --player-operation-mode=pseudo-gui -- %UEtc.
@mvdan I hope this helps. FWIW, I don’t think @gokcehan would want to implement rifle under the wings of this project.
You can use install ranger and only use
rifleas your$OPENER.