From 61ec5e1396ecc3dcebfd9f3064f1a92575befde4 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Mon, 1 Mar 2021 05:41:15 +0900 Subject: exwm: Update `exwm-rename-buffer` function --- .exwm | 11 +++++++++-- 1 file 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) -- cgit v1.2.3