Rework exwmx-launch-program

This commit is contained in:
Benson Chu 2023-09-01 10:07:39 +08:00
parent afbacc8952
commit 4c7583a8eb
2 changed files with 15 additions and 20 deletions

View file

@ -25,26 +25,10 @@
;;; Code:
(use-package dmenu)
(make-thread
#'dmenu--cache-executable-files)
(defun read-program ()
(funcall #'ido-completing-read "$ "
(append dmenu--history-list
(cl-remove-if (lambda (x)
(member x dmenu--history-list))
dmenu--cache-executable-files))))
(defun launch-program (command &optional process-name)
(interactive (list (read-program)))
(setq dmenu--history-list (cons command (remove command dmenu--history-list)))
(when (> (length dmenu--history-list)
dmenu-history-size)
(setcdr (nthcdr (- dmenu-history-size 1)
dmenu--history-list)
nil))
(let ((name (or process-name command)))
(start-process-shell-command name nil command)))
(defun dmenu-refresh-applist ()
(interactive)
(make-thread
#'dmenu--cache-executable-files))
(provide 'exwm-launch-program)
;;; exwm-launch-program.el ends here

View file

@ -218,6 +218,17 @@ and :title or just a key list."
(interactive)
(my/exwmx-quickrun ,cmd nil '(:pretty-name ,name)))))
(add-to-list 'vertico-multiform-commands
'(exwmx-launch-program flat (vertico-cycle . t)))
(defun read-program ()
(completing-read
"$ "
(append dmenu--history-list
(cl-remove-if (lambda (x)
(member x dmenu--history-list))
dmenu--cache-executable-files))))
(defun exwmx-launch-program (command &optional process-name)
(interactive (list (read-program)))
(setq dmenu--history-list (cons command (remove command dmenu--history-list)))