From a43c72e5c8af4fcd36b88b710515ec54b39ce5b2 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 6 Feb 2022 22:17:34 -0600 Subject: Modularize tab-bar more --- lisp/+tab-bar.el | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'lisp/+tab-bar.el') diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index f143388..83870e9 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el @@ -19,10 +19,34 @@ (defun +tab-bar-misc-info () "Display `mode-line-misc-info', formatted for the tab-bar." - `((global menu-item ,(string-trim-right + `((misc-info menu-item ,(string-trim-right (format-mode-line mode-line-misc-info)) - - ignore :help (discord-date-string)))) + ignore))) + +(defun +tab-bar-tracking-mode () + "Display `tracking-mode-line-buffers' in the tab-bar." + ;; TODO: write something to convert a mode-line construct to a tab-bar + ;; construct. + (when tracking-mode + (cl-loop for i from 0 below (length tracking-mode-line-buffers) + as item = (nth i tracking-mode-line-buffers) + collect (append (list (intern (format "tracking-mode-line-%s" i)) + 'menu-item + (format-mode-line item)) + (if-let ((keymap (plist-get item 'keymap))) + (list (alist-get 'down-mouse-1 (cdadr keymap))) + (list #'ignore)) + (when-let ((help (plist-get item 'help-echo))) + (list :help help)))))) + +(defun +tab-bar-date () + "Display `display-time-string' in the tab-bar." + (when display-time-mode + `((date-time-string menu-item + ,(propertize display-time-string + 'face 'font-lock-comment-face) + ignore + :help (discord-date-string))))) (defvar +tab-bar-show-original nil "Original value of `tab-bar-show'.") -- cgit 1.4.1-21-gabe81