From 22b3b0504579e661321ad3fe2f16fd279b85a0b7 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Wed, 9 Aug 2023 04:16:46 +0300 Subject: emacs: Update dired functions & keys Add - dired-watch-vivdeo: Watch video using mpv - dired-set-wallpaper: Set image as wallpaper using feh Add those 2 commands as keybindings in dired-mode-map --- emacs.org | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/emacs.org b/emacs.org index 32b4934..d87e954 100755 --- a/emacs.org +++ b/emacs.org @@ -310,15 +310,22 @@ Generate a random password between 20 and 40 characters #+begin_src emacs-lisp (defun dired-watch-video () (interactive) - (async-shell-command - (format "mpv \"%s\"" (dired-get-filename)))) + (call-process-shell-command + (format "mpv \"%s\"" (dired-get-filename)) nil 0)) + + (defun dired-set-wallpaper () + "Set NAME as wallpaper." + (interactive) + (call-process-shell-command + (format "feh --bg-scale %s" (dired-get-filename) nil 0))) #+end_src ** Keybindings #+begin_src emacs-lisp (require 'dired) - (define-key dired-mode-map "b" 'dired-up-directory) - (define-key dired-mode-map "v" 'dired-watch-video) - (define-key dired-mode-map "z" 'wdired-change-to-wdired-mode) + (define-key dired-mode-map (kbd "b") 'dired-up-directory) + (define-key dired-mode-map (kbd "v") 'dired-watch-video) + (define-key dired-mode-map (kbd "z") 'wdired-change-to-wdired-mode) + (define-key dired-mode-map (kbd "C-c w") 'dired-set-wallpaper) #+end_src ** All-the-icons #+begin_src emacs-lisp -- cgit v1.2.3