diff options
author | Masaya Tojo <masaya@tojo.tokyo> | 2021-03-01 05:41:15 +0900 |
---|---|---|
committer | Masaya Tojo <masaya@tojo.tokyo> | 2021-03-01 05:41:15 +0900 |
commit | 61ec5e1396ecc3dcebfd9f3064f1a92575befde4 (patch) | |
tree | 548b4f8471260aedea853d1473177d8a68633c74 | |
parent | 84fc25ce83e9385ca9152dfe75d5336543f24dd0 (diff) |
exwm: Update `exwm-rename-buffer` function
-rw-r--r-- | .exwm | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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) |