aboutsummaryrefslogtreecommitdiff
path: root/.exwm
diff options
context:
space:
mode:
Diffstat (limited to '.exwm')
-rw-r--r--.exwm11
1 files changed, 9 insertions, 2 deletions
diff --git a/.exwm b/.exwm
index 25e5aba..a02b338 100644
--- a/.exwm
+++ b/.exwm
@@ -27,12 +27,19 @@
(call-process-shell-command "setxkbmap -option ctrl:nocaps")
+(defun truncate-exwm-title (s)
+ (if (<= (string-width s) 49)
+ s
+ (truncate-exwm-title (substring s 0 -1))))
+
(defun exwm-rename-buffer ()
(interactive)
(exwm-workspace-rename-buffer
(concat exwm-class-name ":"
- (if (<= (length exwm-title) 50) exwm-title
- (concat (substring exwm-title 0 49) "...")))))
+ (if (or (stringp exwm-title)
+ (<= (string-width exwm-title) 50))
+ exwm-title
+ (concat (truncate-exwm-title exwm-title) "…")))))
(add-hook 'exwm-update-class-hook 'exwm-rename-buffer)
(add-hook 'exwm-update-title-hook 'exwm-rename-buffer)