Introduce *swm-ssh-default-term-title-opt*

`-T` looks a universal option for `xterm` and `urxvtc`, but `sakura`
requries `-t` (or `--title`) for example.
This commit is contained in:
Kirill A. Korinsky 2025-05-25 20:56:09 +02:00
parent 1e3fa7abae
commit 46c3ef3cf1
No known key found for this signature in database
GPG key ID: 98D8D9867759226E
2 changed files with 20 additions and 1 deletions

View file

@ -31,6 +31,14 @@ Default terminal to open an ssh connection is ~urxvtc~. To change it, use
(setq swm-ssh:*swm-ssh-default-term* "xterm")
#+END_SRC
** *swm-ssh-default-term-title-opt*
Default terminal's title option is ~-T~ which is used to setup title to
a connection host. It works with both ~xterm~ and ~urxvtc~ out of the
box. ~nil~ disable it. To change it, use
#+BEGIN_SRC lisp
(setq swm-ssh:*swm-ssh-default-termt-itle-opt* "--title")
#+END_SRC
** *swm-ssh-known-host-path*
Path to thee list of know host bz SSH client. Defaults to =~/.ssh/known_hosts=.
Change it with

View file

@ -3,6 +3,7 @@
(defpackage #:swm-ssh
(:use #:cl #:stumpwm)
(:export #:*swm-ssh-default-term*
#:*swm-ssh-default-term-title-opt*
#:*swm-ssh-known-hosts-path*)
(:import-from #:cl-ppcre))
@ -14,6 +15,8 @@
(defvar *swm-ssh-default-term* "urxvtc")
(defvar *swm-ssh-default-term-title-opt* "-T")
(defun collect-hosts (&optional (ssh-known-hosts *swm-ssh-known-hosts-path*))
(with-open-file (stream ssh-known-hosts :direction :input)
(loop for line = (read-line stream nil)
@ -32,4 +35,12 @@
(when entry
(let ((host (car entry)))
(stumpwm:run-shell-command
(format nil "~A -T ~A -e ssh ~A" *swm-ssh-default-term* host host))))))
(if *swm-ssh-default-term-title-opt*
(format nil "~A ~A ~A -e ssh ~A"
*swm-ssh-default-term*
*swm-ssh-default-term-title-opt*
host
host)
(format nil "~A -e ssh ~A"
*swm-ssh-default-term*
host)))))))