diff options
-rw-r--r-- | init.org | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -1814,18 +1814,15 @@ (term-send-string nil (concat cmd " ; exit\n")))) (defmacro jao-def-exec-in-term (name cmd &rest prelude) - `(defun ,(intern (format "jao-term-%s" name)) () - (interactive) + `(defun ,(intern (format "jao-term-%s" name)) (&optional term) + (interactive "P") ,@prelude - (if-let ((b (jao-term--find ,cmd))) - (pop-to-buffer b) - (jao-exec-in-term ,cmd ,(format "*%s*" name)) - (setq-local jao-term--cmd ,cmd)))) + (let ((jao-use-vterm (if term (not jao-use-vterm) jao-use-vterm))) + (if-let ((b (jao-term--find ,cmd))) + (pop-to-buffer b) + (jao-exec-in-term ,cmd ,(format "*%s*" name)) + (setq-local jao-term--cmd ,cmd))))) - (jao-def-exec-in-term "aptitude" "aptitude" (jao-afio--goto-scratch)) - (jao-def-exec-in-term "htop" "htop" (jao-afio--goto-scratch)) - (jao-def-exec-in-term "spt" "spt" (jao-afio--goto-scratch)) - (jao-def-exec-in-term "ncmpcpp" "ncmpcpp" (jao-afio--goto-scratch)) #+end_src *** eshell ***** Basic custom @@ -2920,6 +2917,8 @@ (defalias 'jao-spotify-artist #'consult-spotify-artist) (defalias 'jao-spotify-playlist #'consult-spotify-playlist) + (jao-def-exec-in-term "ncmpcpp" "ncmpcpp" (jao-afio--goto-scratch)) + (use-package jao-mpris :demand t :config @@ -2959,6 +2958,8 @@ (defun jao-spt-on-p () jao-spt-on) (jao-spt-setup-aliases) + (jao-def-runner jao-term-spt 0 "spt" "xterm" "-e" "spt") + (defun jao-spotify-toggle-player () (interactive) (if jao-spt-on (jao-mpris-setup-aliases) (jao-spt-setup-aliases)) @@ -3038,6 +3039,9 @@ (use-package jao-random-album :demand t) + (jao-def-exec-in-term "aptitude" "aptitude" (jao-afio--goto-scratch)) + (jao-def-exec-in-term "htop" "htop" (jao-afio--goto-scratch)) + (transient-define-prefix jao-transient-spotify () [:description (lambda () (format "Spotify using %s" (if jao-spt-on "spt" "MPRIS"))) |