Open FrostyX opened 3 years ago
I have been using https://github.com/xenodium/dwim-shell-command for this.
@FrostyX It seems like a great addition for this package. If you are still interested in implementing this, I will try to assist where possible.
I started working on this and the biggest problem is that xdg-open
doesn't accept multiple parameters. So I came up with something like:
(defun dired-open-xdg ()
"Try to run `xdg-open' to open the file under point."
(interactive)
(when (executable-find "xdg-open")
(let ((files (or (dired-get-marked-files)
(ignore-errors (dired-get-file-for-visit)))))
(dolist (file files)
(call-process-shell-command
(concat "xdg-open '" (file-truename file) "' &"))))))
It kinda works but not as well as I would like. Do you understand what file managers like nautilus or dolphin do, when you select multiple files and press enter?
Not really, my linux environment is really weird :D I use Xmonad as window manager on top of some form of xfce but nothing like a normal desktop environment. But there must be something "simple" to use :/
In GUI file managers (e.g. nautilus, dolphin) it is common to select multiple files of the same type and open them at once. It is useful when for example opening multiple papers in pdf, playing a whole music album the old-school way, queueing multiple videos in vlc, etc.
I am suggesting implementing a function called
dired-open-marked
that would unsurprisingly open all marked files withdired-open
preconfigured command for their filetype. It wouldn't call the external command n times for each file but only once and pass all files as cmd line arguments.I would like to write such feature myself but first, I wanted some ack whether it is something we want to have in this repository (or at all if it is a bad idea).
What do you think?