From 84a846a3a253160178037996bbd4b3e527be7b4f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 28 Nov 2023 15:30:18 +0300 Subject: refactor(tazjin/emacs): move global-mode-line info into tab-bar This removes the wonky hack with detecting the bottom right window, and gives me saner, unified handling of this display in the tab bar (of which there is only one!) Change-Id: Id21c6b2472d0c89fc4d000a10a9e90d2ddba86b6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10165 Reviewed-by: tazjin Autosubmit: tazjin Tested-by: BuildkiteCI --- users/tazjin/emacs/config/desktop.el | 6 ++++++ users/tazjin/emacs/config/functions.el | 10 ---------- users/tazjin/emacs/config/look-and-feel.el | 30 +----------------------------- 3 files changed, 7 insertions(+), 39 deletions(-) (limited to 'users/tazjin/emacs/config') diff --git a/users/tazjin/emacs/config/desktop.el b/users/tazjin/emacs/config/desktop.el index 2688588d20e5..f8ca11f55d11 100644 --- a/users/tazjin/emacs/config/desktop.el +++ b/users/tazjin/emacs/config/desktop.el @@ -109,6 +109,12 @@ ;; tab-bar related config (setq tab-bar-show 1) (setq tab-bar-tab-hints t) + +(setq tab-bar-format + '(tab-bar-format-history + tab-bar-format-tabs tab-bar-separator + tab-bar-format-align-right tab-bar-format-global)) + (setq tab-bar-new-tab-choice (lambda () (get-buffer-create "*scratch*"))) diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el index 3739d25122ef..234423be3986 100644 --- a/users/tazjin/emacs/config/functions.el +++ b/users/tazjin/emacs/config/functions.el @@ -119,16 +119,6 @@ the GPG agent correctly." (run-at-time (password-store-timeout) nil 'password-store-clear)))) -(defun bottom-right-window-p () - "Determines whether the last (i.e. bottom-right) window of the - active frame is showing the buffer in which this function is - executed." - (let* ((frame (selected-frame)) - (right-windows (window-at-side-list frame 'right)) - (bottom-windows (window-at-side-list frame 'bottom)) - (last-window (car (seq-intersection right-windows bottom-windows)))) - (eq (current-buffer) (window-buffer last-window)))) - (defhydra mc/mark-more-hydra (:color pink) ("" mc/mmlte--up "Mark previous like this") ("" mc/mmlte--down "Mark next like this") diff --git a/users/tazjin/emacs/config/look-and-feel.el b/users/tazjin/emacs/config/look-and-feel.el index 6cf2c2a8c100..119922173bef 100644 --- a/users/tazjin/emacs/config/look-and-feel.el +++ b/users/tazjin/emacs/config/look-and-feel.el @@ -24,16 +24,6 @@ (set-frame-font font t t)) ;; Configure telephone-line -(defun telephone-misc-if-last-window () - "Renders the mode-line-misc-info string for display in the - mode-line if the currently active window is the last one in the - frame. - - The idea is to not display information like the current time, - load, battery levels on all buffers." - - (when (bottom-right-window-p) - (telephone-line-raw mode-line-misc-info t))) ;; Implements a mode-line warning if there are any logged in TTY ;; sessions apart from the graphical one. @@ -66,31 +56,13 @@ (format "W: [%s]!!" (s-join "," sessions)))) (defun telephone-line-setup () - (telephone-line-defsegment telephone-line-last-window-segment () - (telephone-misc-if-last-window)) - - ;; Define a highlight font for ~ important ~ information in the last - ;; window. - (defface special-highlight '((t (:foreground "white" :background "#5f627f"))) "") - (add-to-list 'telephone-line-faces - '(highlight . (special-highlight . special-highlight))) - (setq telephone-line-lhs '((highlight . (telephone-line-warn-tty-session)) (nil . (telephone-line-position-segment)) (accent . (telephone-line-buffer-segment)))) (setq telephone-line-rhs - '((accent . (telephone-line-major-mode-segment)) - (nil . (telephone-line-last-window-segment)) - - ;; TODO(tazjin): lets not do this particular thing while I - ;; don't actually run notmuch, there are too many things - ;; that have a dependency on the modeline drawing correctly - ;; (including randr operations!) - ;; - ;; (highlight . (telephone-line-notmuch-counts)) - )) + '((accent . (telephone-line-major-mode-segment)))) (setq telephone-line-primary-left-separator 'telephone-line-tan-left telephone-line-primary-right-separator 'telephone-line-tan-right -- cgit 1.4.1