[StumpWM] Replace explicit calls to terminal by command

In order to make my dotfiles more maintainable in case I change my
terminal emulator, explicit calls to the terminal have been replaced
by calls to the function `term' which itself will call explicitely the
terminal emulator.
This commit is contained in:
Lucien Cartier-Tilet 2021-10-02 12:50:17 +02:00
parent 58d6018199
commit 17835bfe93
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -218,7 +218,6 @@ And its done! We can now move on to the creation of the other CLisp files.
:CUSTOM_ID: Commands-1wagy001v5j0 :CUSTOM_ID: Commands-1wagy001v5j0
:header-args:lisp: :mkdirp :tangle ~/.stumpwm.d/commands.lisp :header-args:lisp: :mkdirp :tangle ~/.stumpwm.d/commands.lisp
:END: :END:
The first command I declare in this file is a command that will avoid 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 me invoking too many Firefox instances. Either Firefox is not already
running and an instance is launched, or one already is and we are running and an instance is launched, or one already is and we are
@ -252,6 +251,16 @@ below the current frame respectively, then focus it.
(move-focus :down)) (move-focus :down))
#+end_src #+end_src
Now, lets create a command for invoking the terminal, optionally with
a program.
#+begin_src lisp
(defcommand term (&optional program) ()
"Invoke a terminal, possibly with a @arg{program}."
(run-shell-command (if program
(format nil "kitty ~A" program)
"kitty")))
#+end_src
And done! Next! And done! Next!
* Colors * Colors
@ -840,7 +849,7 @@ The application keymap can now be bound to the root map like so:
I will also bind to the top map ~s-RET~ in order to open a new terminal I will also bind to the top map ~s-RET~ in order to open a new terminal
window. The screenshot keymap is also bound to the ScreenPrint key. window. The screenshot keymap is also bound to the ScreenPrint key.
#+begin_src lisp #+begin_src lisp
(define-key *top-map* (kbd "s-RET") "exec kitty") (define-key *top-map* (kbd "s-RET") "term")
(define-key *top-map* (kbd "Print") '*my-screenshot-keymap*) (define-key *top-map* (kbd "Print") '*my-screenshot-keymap*)
#+end_src #+end_src