diff options
author | jao <jao@gnu.org> | 2021-12-15 21:55:18 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-12-15 21:55:18 +0000 |
commit | f923ad94c799175177f5a0f333824b201eaf5088 (patch) | |
tree | dc06245071e2b48d794b471a7d5781c67f3c13d8 | |
parent | 92bc885ac9040d23f50d506a351b5576be6ccddf (diff) | |
download | elibs-f923ad94c799175177f5a0f333824b201eaf5088.tar.gz elibs-f923ad94c799175177f5a0f333824b201eaf5088.tar.bz2 |
jao-minibuffer: make room again for tray icons
-rw-r--r-- | exwm.org | 25 | ||||
-rw-r--r-- | lib/eos/jao-minibuffer.el | 9 |
2 files changed, 18 insertions, 16 deletions
@@ -148,18 +148,19 @@ #+end_src * Minibuffer and system tray - #+BEGIN_SRC emacs-lisp - (require 'exwm-systemtray) - (exwm-systemtray-enable) - - (setq jao-minibuffer-frame-width 271) - (add-hook 'exwm-workspace-switch-hook #'jao-minibuffer-refresh) - - (defun jao-exwm--watch-tray (sym newval op where) - (setq jao-minibuffer-right-margin (* 2 (length newval))) - (jao-minibuffer-refresh)) - (add-variable-watcher 'exwm-systemtray--list #'jao-exwm--watch-tray) -#+END_SRC + #+begin_src emacs-lisp + (require 'exwm-systemtray) + (exwm-systemtray-enable) + + (setq jao-minibuffer-frame-width 271) + (add-hook 'exwm-workspace-switch-hook #'jao-minibuffer-refresh) + + (defun jao-exwm--watch-tray (sym newval op where) + (setq jao-minibuffer-right-margin (make-string (* 2 (length newval)) ?\ )) + (jao-minibuffer-refresh)) + + (add-variable-watcher 'exwm-systemtray--list #'jao-exwm--watch-tray) + #+end_src * Switch to buffer / app #+begin_src emacs-lisp (defvar-local jao-exwm--name nil) diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el index 100e809..36c5238 100644 --- a/lib/eos/jao-minibuffer.el +++ b/lib/eos/jao-minibuffer.el @@ -28,7 +28,7 @@ (defvar jao-minibuffer-msg-info '("")) (defvar jao-minibuffer-notification nil) (defvar jao-minibuffer-align-right-p t) -(defvar jao-minibuffer-right-margin (if window-system 0 1)) +(defvar jao-minibuffer-right-margin (if window-system "" " ")) (defvar jao-minibuffer-maximized-frames-p nil) (defvar jao-minibuffer-frame-width nil) (defvar jao-minibuffer-notification-timeout 5) @@ -41,11 +41,12 @@ (defun jao-minibuffer--text-with-padding (text) "Return TEXT with padding on the left. The padding pushes TEXT to the right edge of the mode-line." - (let* ((len (- (string-pixel-width text) jao-minibuffer-right-margin)) + (let* ((len (+ (string-pixel-width text) + (string-pixel-width jao-minibuffer-right-margin))) (padding (propertize "-" 'display `(space :align-to (- (+ right right-margin) (,len)))))) - (concat padding text))) + (concat padding text jao-minibuffer-right-margin))) (defun jao-minibuffer--trim (s w) (if (<= (string-width (or s "")) w) @@ -84,7 +85,7 @@ The padding pushes TEXT to the right edge of the mode-line." (jao-minibuffer--text-with-padding msg) (let* ((mw (jao-minibuffer--width)) (w (mod (or w (string-width (or (current-message) ""))) mw)) - (w (- mw w jao-minibuffer-right-margin))) + (w (- mw w (length jao-minibuffer-right-margin)))) (if (> w 0) (jao-minibuffer--trim msg w) "")))))) (defun jao-minibuffer--insert (msg) |