From 17835bfe93e6a2dc6be05dfeae42f58748744323 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Sat, 2 Oct 2021 12:50:17 +0200 Subject: [PATCH] [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. --- org/config/stumpwm.org | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/org/config/stumpwm.org b/org/config/stumpwm.org index e9631cd..ed05d3f 100644 --- a/org/config/stumpwm.org +++ b/org/config/stumpwm.org @@ -218,7 +218,6 @@ And it’s done! We can now move on to the creation of the other CLisp files. :CUSTOM_ID: Commands-1wagy001v5j0 :header-args:lisp: :mkdirp :tangle ~/.stumpwm.d/commands.lisp :END: - 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 @@ -252,6 +251,16 @@ below the current frame respectively, then focus it. (move-focus :down)) #+end_src +Now, let’s 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! * 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 window. The screenshot keymap is also bound to the ScreenPrint key. #+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*) #+end_src