diff options
author | Thanos Apollo <[email protected]> | 2023-06-27 05:31:08 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-06-27 05:31:08 +0300 |
commit | 5ba21168f593c849ea3e0f98a821156d0013db3d (patch) | |
tree | fe5322b2b5bfdb1ff1307c06e4e3ca397a2f7dc5 | |
parent | 74d990131344b9eb8258a86e531ecb3f4bba39d8 (diff) |
stumpwm: Update modeline
-rw-r--r-- | stumpwm.org | 62 |
1 files changed, 13 insertions, 49 deletions
diff --git a/stumpwm.org b/stumpwm.org index aabd27c..9d25224 100644 --- a/stumpwm.org +++ b/stumpwm.org @@ -225,40 +225,6 @@ ,*hidden-window-color* "^**" ,*mode-line-highlight-template* "«~A»") - (defvar *mode-line-formatter-list* - '(("%g") ("%W") ("^>") ("docker-running" . t) ("mu-unread" . t) ("%m") ("%C") ("%M") ("%B") ("%d")) - "List of formatters for the modeline.") - - (defun generate-modeline (elements &optional not-invertedp rightp) - "Generate a modeline for StumpWM. - 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 - when the `car' is a formatter and t when it is a shell command." - (when elements - (cons (format nil - " ^[~A^]^(:bg \"~A\") " - (format nil "^(:fg \"~A\")^(:bg \"~A\")^f1~A^f0" - (if (xor not-invertedp rightp) phundrak-nord1 phundrak-nord3) - (if (xor not-invertedp rightp) phundrak-nord3 phundrak-nord1) - (if rightp "" "")) - (if not-invertedp phundrak-nord3 phundrak-nord1)) - (let* ((current-element (car elements)) - (formatter (car current-element)) - (commandp (cdr current-element))) - (cons (if commandp - `(:eval (run-shell-command ,formatter t)) - (format nil "~A" formatter)) - (generate-modeline (cdr elements) - (not not-invertedp) - (if (string= "^>" (caar elements)) t rightp))))))) - - (defcommand reload-modeline () () - "Reload modeline." - (sb-thread:make-thread - (lambda () - (setf *screen-mode-line-format* - (cdr (generate-modeline *mode-line-formatter-list*)))))) - (when *initializing* (grename "[EMACS]") @@ -267,20 +233,18 @@ (clear-window-placement-rules) (setf *dynamic-group-master-split-ratio* 1/2) - (setf *window-format* "%m%n%s%c") - (setf *screen-mode-line-format* (list "%g ^> %d")) - - (enable-mode-line (current-screen) (current-head) t) - - (setf *mode-line-timeout* 2) - - (setf *time-modeline-string* "%F %H:%M") - - (setf *group-format* "%t") - - (setf *window-format* "%n: %30t") - - + (defun get-hostname () + (with-open-file (stream "/etc/hostname") + (let ((hostname (read-line stream))) + (close stream) + hostname))) + + (if (equal (get-hostname) "zeus") + (setf stumpwm:*screen-mode-line-format* + (list "%g %a%p | ^>" (stumpwm:run-shell-command "date" t))) + + (setf stumpwm:*screen-mode-line-format* + (list "%g | ^> | Battery : %B |" (stumpwm:run-shell-command "date" t)))) #+end_src * Keybindings #+begin_src lisp @@ -297,7 +261,7 @@ (define-key *root-map* (kbd "f") "float-this") (define-key *root-map* (kbd "C-f") "unfloat-this") - + (defvar *thanos-buffers-map* (let ((m (make-sparse-keymap))) (define-key m (kbd "0") "delete-window-and-frame") |