Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dired-open: support for opening multiple files at once #187

Open
FrostyX opened this issue Oct 6, 2021 · 4 comments
Open

dired-open: support for opening multiple files at once #187

FrostyX opened this issue Oct 6, 2021 · 4 comments

Comments

@FrostyX
Copy link

FrostyX commented Oct 6, 2021

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 with dired-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?

@gvoysey
Copy link

gvoysey commented Sep 1, 2022

I have been using https://github.com/xenodium/dwim-shell-command for this.

@Fuco1
Copy link
Owner

Fuco1 commented Apr 3, 2024

@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.

@FrostyX
Copy link
Author

FrostyX commented Apr 8, 2024

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?

@Fuco1
Copy link
Owner

Fuco1 commented Apr 9, 2024

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 :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

3 participants