From 4394d983a93348c6246170f2a62a2907780601b2 Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Sun, 6 Nov 2022 19:40:30 -0900 Subject: [PATCH] Telephone-line with airline colors --- lisp/mitch-packages.el | 94 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 87 insertions(+), 7 deletions(-) diff --git a/lisp/mitch-packages.el b/lisp/mitch-packages.el index ac68d90..ab90b5c 100644 --- a/lisp/mitch-packages.el +++ b/lisp/mitch-packages.el @@ -419,12 +419,12 @@ targets." "v" 'multi-vterm-other-window)) ;; Better modeline? Better modeline. -(use-package powerline - :custom - (powerline-display-buffer-size nil) - (powerline-default-separator 'utf-8) - (powerline-utf-8-separator-left (string-to-char "")) - (powerline-utf-8-separator-right (string-to-char ""))) +;; (use-package powerline +;; :custom +;; (powerline-display-buffer-size nil) +;; (powerline-default-separator 'utf-8) +;; (powerline-utf-8-separator-left (string-to-char "")) +;; (powerline-utf-8-separator-right (string-to-char ""))) (use-package airline-themes :custom (airline-cursor-colors nil) @@ -432,6 +432,85 @@ targets." (airline-eshell-colors nil) (airline-shortened-directory-length 20)) +;; see https://github.com/dbordak/telephone-line/issues/126 +(use-package telephone-line + :custom-face + (mode-line-buffer-id + ((t (:inherit mode-line-active)))) + :init + (load-theme 'airline-kolor) + (fmakunbound #'airline-themes-set-modeline) + (setq telephone-line-primary-left-separator 'telephone-line-identity-left + telephone-line-secondary-left-separator 'telephone-line-identity-hollow-left + telephone-line-primary-right-separator 'telephone-line-identity-right + telephone-line-secondary-right-separator 'telephone-line-identity-hollow-right) + (setq telephone-line-lhs + '((evil . (telephone-line-evil-tag-segment)) + (accent . (telephone-line-vc-segment + telephone-line-erc-modified-channels-segment + telephone-line-process-segment)) + (nil . (telephone-line-minor-mode-segment + telephone-line-buffer-segment)))) + (setq telephone-line-rhs + '((nil . (telephone-line-misc-info-segment)) + (accent . (telephone-line-major-mode-segment)) + (evil . (telephone-line-airline-position-segment)))) + (defun airline/telephone-line-evil-face (active) + "Return an appropriate face for the current mode." + (let* ((evil-mode-active (featurep 'evil)) + (outer-face + (if active + (if evil-mode-active + (cond ((eq evil-state (intern "normal")) 'airline-normal-outer) + ((eq evil-state (intern "insert")) 'airline-insert-outer) + ((eq evil-state (intern "visual")) 'airline-visual-outer) + ((eq evil-state (intern "replace")) 'airline-replace-outer) + ((eq evil-state (intern "emacs")) 'airline-emacs-outer) + (t 'airline-normal-outer)) + 'airline-normal-outer) + 'powerline-inactive1)) + ) + outer-face)) + (defun airline/telephone-line-accent-face (active) + "Return an appropriate face for the current mode." + (let* ((evil-mode-active (featurep 'evil)) + (inner-face + (if active + (if evil-mode-active + (cond ((eq evil-state (intern "normal")) 'airline-normal-inner) + ((eq evil-state (intern "insert")) 'airline-insert-inner) + ((eq evil-state (intern "visual")) 'airline-visual-inner) + ((eq evil-state (intern "replace")) 'airline-replace-inner) + ((eq evil-state (intern "emacs")) 'airline-emacs-inner) + (t 'airline-normal-inner)) + 'airline-normal-inner) + 'powerline-inactive2)) + ) + inner-face)) + (defun airline/telephone-line-nil-face (active) + "Return an appropriate face for the current mode." + (let* ((evil-mode-active (featurep 'evil)) + (center-face + (if active + (if evil-mode-active + (cond ((eq evil-state (intern "normal")) 'airline-normal-center) + ((eq evil-state (intern "insert")) 'airline-insert-center) + ((eq evil-state (intern "visual")) 'airline-visual-center) + ((eq evil-state (intern "replace")) 'airline-replace-center) + ((eq evil-state (intern "emacs")) 'airline-emacs-center) + (t 'airline-normal-center)) + 'airline-normal-center) + 'airline-inactive3)) + ) + center-face)) + (setq telephone-line-faces + '((evil . airline/telephone-line-evil-face) + (accent . airline/telephone-line-accent-face) + (nil . airline/telephone-line-nil-face))) + :config + (telephone-line-mode t) +) + ;; Themes are weird and stupid ;; (use-package xemacs-theme ;; :straight (:type git @@ -457,7 +536,8 @@ targets." :config (mitch/visual-setup) :init (load-theme 'mitch t) - (load-theme 'airline-kolor t)) + ;; (load-theme 'airline-kolor t) ;; re-enable + ) (use-package yascroll :diminish