@@ -96,6 +96,20 @@ switch, so the number of updates is increased significantly."
96
96
(advice-remove #'exwm--update-hints #'exwm-modeline--urgency-advice )
97
97
(remove-hook 'exwm-workspace-switch-hook #'exwm-modeline--urgency-advice )))))
98
98
99
+ (defcustom exwm-modeline-workspace-index-map 'exwm-workspace-index-map
100
+ " Function for mapping a workspace index to a string for display.
101
+
102
+ If the value if 'exwm-workspace-index-map, dereference the
103
+ `exwm-workspace-index-map' variable. Otherwise, use a function."
104
+ :group 'exwm-workspace
105
+ :type '(choice
106
+ (symbol exwm-workspace-index-map :tag " Use EXWM default" )
107
+ (function ))
108
+ :set (lambda (sym value )
109
+ (set-default sym value)
110
+ (when (bound-and-true-p exwm-modeline-mode)
111
+ (exwm-modeline-update))))
112
+
99
113
(defface exwm-modeline-current-workspace
100
114
; ; I'd rather :inherit and override warning there, but well
101
115
`((t :foreground ,(face-foreground 'warning ) :weight bold ))
@@ -130,14 +144,22 @@ Always return nil if `exwm-modeline-display-urgent' is not set."
130
144
if (eq frame (buffer-local-value 'exwm--frame (cdr item)))
131
145
return t ))
132
146
147
+ (defun exwm-modeline--workspace-index-map (i )
148
+ " Map the workspace index I to a string for display.
149
+
150
+ See `exwm-modeline-workspace-index-map' for behaviour."
151
+ (if (eq exwm-modeline-workspace-index-map 'exwm-workspace-index-map )
152
+ (funcall exwm-workspace-index-map i)
153
+ (funcall exwm-modeline-workspace-index-map i)))
154
+
133
155
(defun exwm-modeline--click (event )
134
156
" Process a click EVENT on the modeline segment."
135
157
(interactive " e" )
136
158
(when-let
137
159
(target
138
160
(cl-loop with name = (format " %s " (car (posn-string (event-start event))))
139
161
for i from 0 to (1- (length exwm-workspace--list))
140
- if (string-equal (funcall exwm-workspace-index-map i) name)
162
+ if (string-equal (exwm-modeline- -workspace-index-map i) name)
141
163
return i))
142
164
(exwm-workspace-switch target)))
143
165
@@ -153,8 +175,8 @@ Always return nil if `exwm-modeline-display-urgent' is not set."
153
175
WORKSPACE-LIST is the list of frames to display."
154
176
(cl-loop for frame in workspace-list
155
177
for i from 0 to (length workspace-list)
156
- for workspace-name = (funcall exwm-workspace-index-map
157
- (exwm-workspace--position frame))
178
+ for workspace-name = (exwm-modeline- -workspace-index-map
179
+ (exwm-workspace--position frame))
158
180
with current-frame = (selected-frame )
159
181
if (= i 0 ) collect (nth 0 exwm-modeline-dividers)
160
182
collect
0 commit comments