diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-10-01 16:21:39 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-10-01 16:26:00 +0100 |
commit | 7a03b0d585275fadf275c9b028ea9053334fcbcf (patch) | |
tree | 56d53e94d90ba231cc2d7a049f3e96ef0219d6a8 /Emacs | |
parent | e3e37f3fab18c9f3b5d04f959e4598f579e55a86 (diff) | |
download | dotfiles-7a03b0d585275fadf275c9b028ea9053334fcbcf.tar.gz dotfiles-7a03b0d585275fadf275c9b028ea9053334fcbcf.tar.bz2 dotfiles-7a03b0d585275fadf275c9b028ea9053334fcbcf.zip |
Move mpv module into configuration directly
Diffstat (limited to 'Emacs')
-rw-r--r-- | Emacs/.config/emacs/config.org | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index b99d649..185e5fb 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -2316,13 +2316,31 @@ and integrates slickly into image-dired. Of course, "l" #'image-forward-hscroll)) #+end_src ** mpv -My [[file:elisp/mpv.el][custom mpv module]] for opening videos in -Emacs. - +Little helper which launches an MPV process asynchronously. #+begin_src emacs-lisp -(use-package mpv +(use-package emacs :defer t - :load-path "elisp/" + :config + (defvar mpv-args "-v --profile=fast --hwdec=auto-copy" + "General arguments for mpv binary.") + + (defun mpv-start-process (url) + (message "[mpv]: Starting mpv on `%s'" url) + (with-current-buffer (get-buffer-create "*mpv*") + (ansi-color-for-comint-mode-on) + (comint-mode)) + (set-process-filter (start-process-shell-command + "mpv" "*mpv*" + (concat "mpv " mpv-args " \"" url "\"")) + #'comint-output-filter)) + + (defun mpv-open-video (&optional arg) + (interactive) + (let ((url (if (stringp arg) + arg + (expand-file-name (read-file-name "URL?: " default-directory "" t))))) + (mpv-start-process url) + (switch-to-buffer "*mpv*"))) :general (app-leader "v" #'mpv-open-video)) |