From c0066af134cb0ffb21889b455963c6917fd690e7 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 24 Nov 2025 05:54:37 -0800 Subject: feat(dwim-shell): fix M-D menu binding and enhance audio extraction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix dwim-shell-commands-menu keybinding in dirvish/dired - Remove :after (dired dirvish) which prevented package loading - Add :demand t to load package immediately at startup - Move keybindings inside :config block after menu function definition - M-D now works immediately in dirvish without manual trigger - Enhance extract-audio-from-video function - Fix :extensions parameter (was regex string, now proper list) - Change from copy to AAC re-encoding for codec compatibility - Add interactive bitrate selection (64k/96k/128k/192k) - Fixes Opus codec compatibility issues with M4A containers - Remove conflicting keybindings - Remove music-config p binding in dirvish (was overriding path copy) - Clean up extraneous requires/hooks from troubleshooting - Add TODO for dwim-shell-command status dashboard [#D priority] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- modules/dwim-shell-config.el | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'modules/dwim-shell-config.el') diff --git a/modules/dwim-shell-config.el b/modules/dwim-shell-config.el index a05646b2..1881f791 100644 --- a/modules/dwim-shell-config.el +++ b/modules/dwim-shell-config.el @@ -90,16 +90,10 @@ (require 'cl-lib) - -;; Bind menu to dired (after dwim-shell-command loads) -(with-eval-after-load 'dwim-shell-command - (with-eval-after-load 'dired - (keymap-set dired-mode-map "M-D" #'dwim-shell-commands-menu))) - ;; ----------------------------- Dwim Shell Command ---------------------------- (use-package dwim-shell-command - :after (dired dirvish) + :demand t :bind ((" " . dwim-shell-command) :map dired-mode-map (" " . dwim-shell-command) @@ -606,10 +600,14 @@ in process lists or command history." (defun cj/dwim-shell-commands-extract-audio-from-video () "Extract audio track from video file(s)." (interactive) - (dwim-shell-command-on-marked-files - "Extract audio" - "ffmpeg -i '<>' -vn -acodec copy '<>.m4a'" - :utils "ffmpeg")) + (let ((bitrate (completing-read "Audio bitrate: " + '("64k" "96k" "128k" "192k") + nil t))) + (dwim-shell-command-on-marked-files + "Extract audio" + (format "ffmpeg -i '<>' -vn -c:a aac -b:a %s '<>.m4a'" bitrate) + :utils "ffmpeg" + :extensions '("mp4" "mkv" "webm" "avi" "mov" "flv" "wmv" "m4v" "mpg" "mpeg" "ogv" "3gp" "ts")))) (defun cj/dwim-shell-commands-normalize-audio-volume () "Normalize audio volume in file(s)." @@ -809,7 +807,13 @@ gpg: decryption failed: No pinentry" 'dwim-shell-command-history)) (command (alist-get selected command-alist nil nil #'string=))) (when command - (call-interactively command))))) + (call-interactively command)))) + + ;; Bind menu to keymaps after function is defined + (with-eval-after-load 'dired + (keymap-set dired-mode-map "M-D" #'dwim-shell-commands-menu)) + (with-eval-after-load 'dirvish + (keymap-set dirvish-mode-map "M-D" #'dwim-shell-commands-menu))) (provide 'dwim-shell-config) ;;; dwim-shell-config.el ends here. -- cgit v1.2.3