[StumpWM] Change direction powerline in mode-line, update screenshot
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Lucien Cartier-Tilet 2021-12-18 14:26:29 +01:00
parent 7195f92017
commit 725233bd4b
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
2 changed files with 12 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 KiB

After

Width:  |  Height:  |  Size: 395 KiB

View File

@ -531,29 +531,28 @@ As you can see, ~generate-modeline~ generates the string defining
~*screen-mode-line-format*~ from the list of formatters we gave it with ~*screen-mode-line-format*~ from the list of formatters we gave it with
the table [[modeline-format]]. the table [[modeline-format]].
#+begin_src lisp #+begin_src lisp
(defun generate-modeline (elements &optional not-invertedp) (defun generate-modeline (elements &optional not-invertedp rightp)
"Generate a modeline for StumpWM. "Generate a modeline for StumpWM.
ELEMENTS should be a list of `cons'es which `car' is the modeline ELEMENTS should be a list of `cons'es which `car' is the modeline
formatter or the shell command to run, and their `cdr' is either nil formatter or the shell command to run, and their `cdr' is either nil
when the `car' is a formatter and t when it is a shell command." when the `car' is a formatter and t when it is a shell command."
(when elements (when elements
(cons (if not-invertedp (cons (format nil
(format nil " ^[~A^]^(:bg \"~A\") "
" ^(:fg \"~A\")^(:bg \"~A\")^f1^f0^(:fg \"~A\") " (format nil "^(:fg \"~A\")^(:bg \"~A\")^f1~A^f0"
phundrak-nord1 (if (xor not-invertedp rightp) phundrak-nord1 phundrak-nord3)
phundrak-nord3 (if (xor not-invertedp rightp) phundrak-nord3 phundrak-nord1)
,*mode-line-foreground-color*) (if rightp "" ""))
(format nil (if not-invertedp phundrak-nord3 phundrak-nord1))
" ^(:fg \"~A\")^(:bg \"~A\")^f1^f0^** "
phundrak-nord3
phundrak-nord1))
(let* ((current-element (car elements)) (let* ((current-element (car elements))
(formatter (car current-element)) (formatter (car current-element))
(commandp (cdr current-element))) (commandp (cdr current-element)))
(cons (if commandp (cons (if commandp
`(:eval (run-shell-command ,formatter t)) `(:eval (run-shell-command ,formatter t))
(format nil "~A" formatter)) (format nil "~A" formatter))
(generate-modeline (cdr elements) (not not-invertedp))))))) (generate-modeline (cdr elements)
(not not-invertedp)
(if (string= "^>" (caar elements)) t rightp)))))))
#+end_src #+end_src
It is then easy to define a command that can call this function and It is then easy to define a command that can call this function and