DEV Community

vindarel
vindarel

Posted on

Run visual commands like htop in Common Lisp

A little trick I just added to the Cookbook: https://lispcookbook.github.io/cl-cookbook/os.html

Running visual commands (htop)

Use uiop:run-program and set both :input and :output to :interactive:

(uiop:run-program "htop" :output :interactive :input :interactive)
Enter fullscreen mode Exit fullscreen mode

This will spawn htop in full screen, as it should.

It works for more commands (sudo, vim…), however not for all interactive
programs, such as less or fzf. If you know how to do it, your contribution will be precious.

If you want more, you'd have to resort to cmd and set its *visual-commands* list with your visual program, to run the interactive command in a new terminal like xterm, or emacsserver (if you use Emacs' vterm you could have emacsserver open the interactive command inside another vterm… it's nearly transparent).

(push "fzf" cmd:*visual-commands*)
(let ((cmd:*terminal* '("xterm" "-e")))
   )
Enter fullscreen mode Exit fullscreen mode

Top comments (0)