aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2021-03-01 05:41:15 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2021-03-01 05:41:15 +0900
commit61ec5e1396ecc3dcebfd9f3064f1a92575befde4 (patch)
tree548b4f8471260aedea853d1473177d8a68633c74
parent84fc25ce83e9385ca9152dfe75d5336543f24dd0 (diff)
exwm: Update `exwm-rename-buffer` function
-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)