config.phundrak.com/docs/stumpwm/commands.org
Lucien Cartier-Tilet 87b3deeed3
All checks were successful
deploy / build (push) Successful in 2m27s
feat: restore sidebar's table of contents for nested pages
2024-01-28 09:06:40 +01:00

1.6 KiB
Raw Permalink Blame History

Commands

Commands

Commands

The first command I declare in this file is a command that will avoid me invoking too many Firefox instances. Either Firefox is not already running and an instance is launched, or one already is, and we are brought to it. This is done like so:

(defcommand firefox () ()
  "Run or raise Firefox."
  (sb-thread:make-thread (lambda () (run-or-raise "firefox" '(:class "Firefox") t nil))))

Next, this command will not only close the current window, but it will also close the current frame.

(defcommand delete-window-and-frame () ()
  "Delete the current frame with its window."
  (delete-window)
  (remove-split))

The two following commands will create a new frame to the right and below the current frame respectively, then focus it.

(defcommand hsplit-and-focus () ()
  "Create a new frame on the right and focus it."
  (hsplit)
  (move-focus :right))

(defcommand vsplit-and-focus () ()
  "Create a new frame below and move focus to it."
  (vsplit)
  (move-focus :down))

Now, lets create a command for invoking the terminal, optionally with a program.

(defcommand term (&optional program) ()
  "Invoke a terminal, possibly with a @arg{program}."
  (sb-thread:make-thread
   (lambda ()
     (run-shell-command (if program
                            (format nil "kitty ~A" program)
                            "kitty")))))