diff options
Diffstat (limited to 'lisp/+tab-bar.el')
-rw-r--r-- | lisp/+tab-bar.el | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 1f4745d..2c39dae 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el | |||
@@ -99,10 +99,10 @@ | |||
99 | emms-player-playing-p) | 99 | emms-player-playing-p) |
100 | (let ((now-playing (+string-truncate (emms-mode-line-playlist-current) | 100 | (let ((now-playing (+string-truncate (emms-mode-line-playlist-current) |
101 | (- +tab-bar-emms-max-length 2)))) | 101 | (- +tab-bar-emms-max-length 2)))) |
102 | `((emms-now-playing menu-item | 102 | `(emms-now-playing menu-item |
103 | ,(concat "{" now-playing "}" " ") | 103 | ,(concat "{" now-playing "}" " ") |
104 | emms-pause | 104 | emms-pause |
105 | :help ,(emms-mode-line-playlist-current)))))) | 105 | ( :help ,(emms-mode-line-playlist-current)))))) |
106 | 106 | ||
107 | (defun +tab-bar-bongo () | 107 | (defun +tab-bar-bongo () |
108 | "Display Bongo now playing information." | 108 | "Display Bongo now playing information." |
@@ -218,6 +218,17 @@ name to the left." | |||
218 | (max 0 (- l-name tab-bar-tab-name-truncated-max l-ell)))) | 218 | (max 0 (- l-name tab-bar-tab-name-truncated-max l-ell)))) |
219 | 'help-echo tab-name)))) | 219 | 'help-echo tab-name)))) |
220 | 220 | ||
221 | (defun +tab-bar-format-align-right () | ||
222 | "Align the rest of tab bar items to the right, pixel-wise." | ||
223 | ;; XXX: ideally, wouldn't require `shr' here | ||
224 | (require 'shr) ; `shr-string-pixel-width' | ||
225 | (let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format))) | ||
226 | (rest (tab-bar-format-list rest)) | ||
227 | (rest (mapconcat (lambda (item) (nth 2 item)) rest "")) | ||
228 | (hpos (shr-string-pixel-width rest)) | ||
229 | (str (propertize " " 'display `(space :align-to (- right (,hpos)))))) | ||
230 | `((align-right menu-item ,str ignore)))) | ||
231 | |||
221 | 232 | ||
222 | ;;; Menu bar | 233 | ;;; Menu bar |
223 | ;; stole from https://github.com/emacs-mirror/emacs/blob/master/lisp/tab-bar.el | 234 | ;; stole from https://github.com/emacs-mirror/emacs/blob/master/lisp/tab-bar.el |