ui/modeline: allow more options for bar
This commit is contained in:
parent
50a82e72f6
commit
76868fe48d
1 changed files with 30 additions and 6 deletions
|
@ -19,6 +19,14 @@
|
||||||
(defvar +modeline-height 21
|
(defvar +modeline-height 21
|
||||||
"How tall the mode-line should be (only respected in GUI emacs).")
|
"How tall the mode-line should be (only respected in GUI emacs).")
|
||||||
|
|
||||||
|
(defvar +modeline-bar-at-end nil
|
||||||
|
"If non-nil, the bar is placed at the end, instead of at the beginning of the
|
||||||
|
modeline.")
|
||||||
|
|
||||||
|
(defvar +modeline-bar-invisible nil
|
||||||
|
"If non-nil, the bar is transparent, and only used to police the height of the
|
||||||
|
mode-line.")
|
||||||
|
|
||||||
(defvar +modeline-buffer-path-function #'+modeline-file-path
|
(defvar +modeline-buffer-path-function #'+modeline-file-path
|
||||||
"The function that returns the buffer name display for file-visiting
|
"The function that returns the buffer name display for file-visiting
|
||||||
buffers.")
|
buffers.")
|
||||||
|
@ -32,6 +40,9 @@ buffers.")
|
||||||
(put '+modeline-format-left 'risky-local-variable t)
|
(put '+modeline-format-left 'risky-local-variable t)
|
||||||
(put '+modeline-format-right 'risky-local-variable t)
|
(put '+modeline-format-right 'risky-local-variable t)
|
||||||
|
|
||||||
|
;;
|
||||||
|
(defvar +modeline--vspc (propertize " " 'face 'variable-pitch))
|
||||||
|
|
||||||
;; externs
|
;; externs
|
||||||
(defvar anzu--state nil)
|
(defvar anzu--state nil)
|
||||||
(defvar evil-mode nil)
|
(defvar evil-mode nil)
|
||||||
|
@ -232,13 +243,25 @@ buffers.")
|
||||||
;; Bars
|
;; Bars
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
(defvar +modeline-bar-start nil "TODO")
|
||||||
|
(put '+modeline-bar-start 'risky-local-variable t)
|
||||||
|
(defvar +modeline-bar-end nil "TODO")
|
||||||
|
(put '+modeline-bar-end 'risky-local-variable t)
|
||||||
|
|
||||||
(defvar +modeline-bar-active nil "TODO")
|
(defvar +modeline-bar-active nil "TODO")
|
||||||
(defvar +modeline-bar-inactive nil "TODO")
|
(defvar +modeline-bar-inactive nil "TODO")
|
||||||
(defun +modeline|setup-bars ()
|
(defun +modeline|setup-bars ()
|
||||||
(setq +modeline-bar-active
|
(setq +modeline-bar-active
|
||||||
(+modeline--make-xpm +modeline-width +modeline-height (face-background 'doom-modeline-bar))
|
(+modeline--make-xpm +modeline-width +modeline-height
|
||||||
|
(unless +modeline-bar-invisible
|
||||||
|
(face-background 'doom-modeline-bar nil t)))
|
||||||
+modeline-bar-inactive
|
+modeline-bar-inactive
|
||||||
(+modeline--make-xpm +modeline-width +modeline-height)))
|
(+modeline--make-xpm +modeline-width +modeline-height))
|
||||||
|
(setq +modeline-bar-start nil
|
||||||
|
+modeline-bar-end nil)
|
||||||
|
(if +modeline-bar-at-end
|
||||||
|
(setq +modeline-bar-end '+modeline-bar)
|
||||||
|
(setq +modeline-bar-start '+modeline-bar)))
|
||||||
(add-hook 'doom-load-theme-hook #'+modeline|setup-bars)
|
(add-hook 'doom-load-theme-hook #'+modeline|setup-bars)
|
||||||
|
|
||||||
(defun +modeline|setup-bars-after-change (sym val op _where)
|
(defun +modeline|setup-bars-after-change (sym val op _where)
|
||||||
|
@ -247,6 +270,8 @@ buffers.")
|
||||||
(+modeline|setup-bars)))
|
(+modeline|setup-bars)))
|
||||||
(add-variable-watcher '+modeline-width #'+modeline|setup-bars-after-change)
|
(add-variable-watcher '+modeline-width #'+modeline|setup-bars-after-change)
|
||||||
(add-variable-watcher '+modeline-height #'+modeline|setup-bars-after-change)
|
(add-variable-watcher '+modeline-height #'+modeline|setup-bars-after-change)
|
||||||
|
(add-variable-watcher '+modeline-bar-at-end #'+modeline|setup-bars-after-change)
|
||||||
|
(add-variable-watcher '+modeline-bar-invisible #'+modeline|setup-bars-after-change)
|
||||||
|
|
||||||
(def-modeline-segment! +modeline-bar
|
(def-modeline-segment! +modeline-bar
|
||||||
(if (active) +modeline-bar-active +modeline-bar-inactive))
|
(if (active) +modeline-bar-active +modeline-bar-inactive))
|
||||||
|
@ -338,7 +363,8 @@ buffers.")
|
||||||
"git-compare"
|
"git-compare"
|
||||||
:face face
|
:face face
|
||||||
:v-adjust -0.05)))
|
:v-adjust -0.05)))
|
||||||
" "
|
+modeline--vspc
|
||||||
|
+modeline--vspc
|
||||||
(propertize (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))
|
(propertize (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))
|
||||||
'face (if active face)))))))
|
'face (if active face)))))))
|
||||||
|
|
||||||
|
@ -483,8 +509,6 @@ segment.")
|
||||||
(add-hook 'deactivate-mark-hook #'+modeline|disable-selection-info)))
|
(add-hook 'deactivate-mark-hook #'+modeline|disable-selection-info)))
|
||||||
|
|
||||||
;; flycheck
|
;; flycheck
|
||||||
(defvar +modeline--vspc (propertize " " 'face 'variable-pitch))
|
|
||||||
|
|
||||||
(defun +doom-ml-icon (icon &optional text face voffset)
|
(defun +doom-ml-icon (icon &optional text face voffset)
|
||||||
"Displays an octicon ICON with FACE, followed by TEXT. Uses
|
"Displays an octicon ICON with FACE, followed by TEXT. Uses
|
||||||
`all-the-icons-octicon' to fetch the icon."
|
`all-the-icons-octicon' to fetch the icon."
|
||||||
|
@ -565,7 +589,7 @@ icons."
|
||||||
,(1+ (string-width rhs-str))))))
|
,(1+ (string-width rhs-str))))))
|
||||||
rhs-str)))
|
rhs-str)))
|
||||||
|
|
||||||
(setq-default mode-line-format '("" +modeline-bar +modeline-format-left +modeline--rest))
|
(setq-default mode-line-format '("" +modeline-bar-start +modeline-format-left +modeline--rest +modeline-bar-end))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue