|
27 | 27 | *mode-line-pad-y* |
28 | 28 | *mode-line-position* |
29 | 29 | *mode-line-timeout* |
| 30 | + *hidden-window-color* |
30 | 31 | *screen-mode-line-format* |
31 | 32 | *screen-mode-line-formatters* |
32 | 33 | add-screen-mode-line-formatter |
|
70 | 71 | (defvar *mode-line-border-color* "Gray30" |
71 | 72 | "The mode line border color.") |
72 | 73 |
|
| 74 | +(defvar *hidden-window-color* "^5*" |
| 75 | + "Color command for hidden windows when using the |
| 76 | +fmt-head-window-list2 formatter. To disable coloring hidden windows, |
| 77 | +set this to an empty string.") |
| 78 | + |
73 | 79 | (defvar *screen-mode-line-format* "[^B%n^b] %W" |
74 | 80 | "This variable describes what will be displayed on the modeline for each screen. |
75 | 81 | Turn it on with the function TOGGLE-MODE-LINE or the mode-line command. |
@@ -105,6 +111,7 @@ List the groups using @var{*group-format*} |
105 | 111 | (#\n fmt-group) |
106 | 112 | (#\W fmt-head-window-list) |
107 | 113 | (#\u fmt-urgent-window-list) |
| 114 | + (#\v fmt-head-window-list-hidden-windows) |
108 | 115 | (#\d fmt-modeline-time)) |
109 | 116 | "An alist containing format character format function pairs for |
110 | 117 | formatting screen mode-lines. functions are passed the screen's |
@@ -184,6 +191,28 @@ timer.") |
184 | 191 | (sort1 (head-windows (mode-line-current-group ml) (mode-line-head ml)) |
185 | 192 | #'< :key #'window-number)))) |
186 | 193 |
|
| 194 | +(defun fmt-hidden (s) |
| 195 | + (format nil (concat "^[" *hidden-window-color* "~A^]") s)) |
| 196 | + |
| 197 | +(defun fmt-head-window-list-hidden-windows (ml) |
| 198 | + "Using *window-format*, return a 1 line list of the windows, space |
| 199 | +separated. The currently focused window is highlighted with |
| 200 | +fmt-highlight. Any non-visible windows are colored the |
| 201 | +*hidden-window-color*." |
| 202 | + (let* ((group (mode-line-current-group ml)) |
| 203 | + (head (mode-line-head ml)) |
| 204 | + (all-wins (head-windows group head)) |
| 205 | + (top-wins (mapcar 'frame-window (head-frames group head))) |
| 206 | + (non-top-wins (set-difference all-wins top-wins))) |
| 207 | + (format nil "~{~a~^ ~}" |
| 208 | + (mapcar (lambda (w) |
| 209 | + (let ((str (format-expand *window-formatters* |
| 210 | + *window-format* w))) |
| 211 | + (cond ((eq w (current-window)) (fmt-highlight str)) |
| 212 | + ((find w non-top-wins) (fmt-hidden str)) |
| 213 | + (t str)))) |
| 214 | + (sort1 all-wins #'< :key #'window-number))))) |
| 215 | + |
187 | 216 | (defun fmt-modeline-time (ml) |
188 | 217 | (declare (ignore ml)) |
189 | 218 | (format-expand *time-format-string-alist* *time-modeline-string*)) |
|
0 commit comments