mirror of
https://github.com/vale981/doom-modeline
synced 2025-03-05 09:21:38 -05:00
[Enhancement] Formalize mouse faces.
This commit is contained in:
parent
7edb863a81
commit
701271488a
2 changed files with 74 additions and 65 deletions
|
@ -873,6 +873,7 @@ directory too."
|
||||||
(and (doom-modeline--active)
|
(and (doom-modeline--active)
|
||||||
'doom-modeline-buffer-file))))
|
'doom-modeline-buffer-file))))
|
||||||
(when face `(:inherit ,face))))))
|
(when face `(:inherit ,face))))))
|
||||||
|
'mouse-face 'mode-line-highlight
|
||||||
'help-echo (concat buffer-file-truename
|
'help-echo (concat buffer-file-truename
|
||||||
(unless (string= (file-name-nondirectory buffer-file-truename)
|
(unless (string= (file-name-nondirectory buffer-file-truename)
|
||||||
(buffer-name))
|
(buffer-name))
|
||||||
|
|
|
@ -326,6 +326,7 @@ Uses `all-the-icons-material' to fetch the icon."
|
||||||
(doom-modeline-buffer-file-name)
|
(doom-modeline-buffer-file-name)
|
||||||
(propertize "%b"
|
(propertize "%b"
|
||||||
'face 'doom-modeline-buffer-file
|
'face 'doom-modeline-buffer-file
|
||||||
|
'mouse-face 'mode-line-highlight
|
||||||
'help-echo "Buffer name
|
'help-echo "Buffer name
|
||||||
mouse-1: Previous buffer\nmouse-3: Next buffer"
|
mouse-1: Previous buffer\nmouse-3: Next buffer"
|
||||||
'local-map mode-line-buffer-identification-keymap))))))
|
'local-map mode-line-buffer-identification-keymap))))))
|
||||||
|
@ -442,15 +443,17 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
||||||
"Displays the eol and the encoding style of the buffer the same way Atom does."
|
"Displays the eol and the encoding style of the buffer the same way Atom does."
|
||||||
(when doom-modeline-buffer-encoding
|
(when doom-modeline-buffer-encoding
|
||||||
(let ((face (if (doom-modeline--active) 'mode-line 'mode-line-inactive))
|
(let ((face (if (doom-modeline--active) 'mode-line 'mode-line-inactive))
|
||||||
(mouse-face '(:box 0)))
|
(mouse-face 'mode-line-highlight))
|
||||||
(concat
|
(concat
|
||||||
|
(doom-modeline-spc)
|
||||||
|
|
||||||
;; eol type
|
;; eol type
|
||||||
(let ((eol (coding-system-eol-type buffer-file-coding-system)))
|
(let ((eol (coding-system-eol-type buffer-file-coding-system)))
|
||||||
(propertize
|
(propertize
|
||||||
(pcase eol
|
(pcase eol
|
||||||
(0 " LF")
|
(0 "LF")
|
||||||
(1 " CRLF")
|
(1 "CRLF")
|
||||||
(2 " CR")
|
(2 "CR")
|
||||||
(_ ""))
|
(_ ""))
|
||||||
'face face
|
'face face
|
||||||
'mouse-face mouse-face
|
'mouse-face mouse-face
|
||||||
|
@ -463,20 +466,22 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line mouse-1] 'mode-line-change-eol)
|
(define-key map [mode-line mouse-1] 'mode-line-change-eol)
|
||||||
map)))
|
map)))
|
||||||
|
|
||||||
|
(doom-modeline-spc)
|
||||||
|
|
||||||
;; coding system
|
;; coding system
|
||||||
(propertize
|
(propertize
|
||||||
(concat
|
(let ((sys (coding-system-plist buffer-file-coding-system)))
|
||||||
(doom-modeline-spc)
|
(cond ((memq (plist-get sys :category)
|
||||||
(let ((sys (coding-system-plist buffer-file-coding-system)))
|
'(coding-category-undecided coding-category-utf-8))
|
||||||
(cond ((memq (plist-get sys :category)
|
"UTF-8")
|
||||||
'(coding-category-undecided coding-category-utf-8))
|
(t (upcase (symbol-name (plist-get sys :name))))))
|
||||||
"UTF-8")
|
|
||||||
(t (upcase (symbol-name (plist-get sys :name))))))
|
|
||||||
(doom-modeline-spc))
|
|
||||||
'face face
|
'face face
|
||||||
'mouse-face mouse-face
|
'mouse-face mouse-face
|
||||||
'help-echo 'mode-line-mule-info-help-echo
|
'help-echo 'mode-line-mule-info-help-echo
|
||||||
'local-map mode-line-coding-system-map)))))
|
'local-map mode-line-coding-system-map)
|
||||||
|
|
||||||
|
(doom-modeline-spc)))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -645,6 +650,7 @@ Uses `all-the-icons-octicon' to fetch the icon."
|
||||||
(substring str 0 (- doom-modeline-vcs-max-length 3))
|
(substring str 0 (- doom-modeline-vcs-max-length 3))
|
||||||
"...")
|
"...")
|
||||||
str)
|
str)
|
||||||
|
'mouse-face 'mode-line-highlight
|
||||||
'face (cond ((eq state 'needs-update)
|
'face (cond ((eq state 'needs-update)
|
||||||
'doom-modeline-warning)
|
'doom-modeline-warning)
|
||||||
((memq state '(removed conflict unregistered))
|
((memq state '(removed conflict unregistered))
|
||||||
|
@ -655,27 +661,27 @@ Uses `all-the-icons-octicon' to fetch the icon."
|
||||||
(advice-add #'vc-refresh-state :after #'doom-modeline-update-vcs-text)
|
(advice-add #'vc-refresh-state :after #'doom-modeline-update-vcs-text)
|
||||||
|
|
||||||
(doom-modeline-def-segment vcs
|
(doom-modeline-def-segment vcs
|
||||||
"Displays the current branch, colored based on its state."
|
"Displays the current branch, colored based on its state."
|
||||||
(let ((active (doom-modeline--active)))
|
(let ((active (doom-modeline--active)))
|
||||||
(when-let ((icon (or doom-modeline--vcs-icon (doom-modeline-update-vcs-icon)))
|
(when-let ((icon (or doom-modeline--vcs-icon (doom-modeline-update-vcs-icon)))
|
||||||
(text (or doom-modeline--vcs-text (doom-modeline-update-vcs-text))))
|
(text (or doom-modeline--vcs-text (doom-modeline-update-vcs-text))))
|
||||||
|
(concat
|
||||||
|
(doom-modeline-spc)
|
||||||
|
(propertize
|
||||||
(concat
|
(concat
|
||||||
(doom-modeline-spc)
|
|
||||||
(propertize
|
|
||||||
(concat
|
|
||||||
(if active
|
|
||||||
icon
|
|
||||||
(propertize icon
|
|
||||||
'face `(:inherit ,(get-text-property 0 'face icon)
|
|
||||||
:inherit mode-line-inactive)))
|
|
||||||
(doom-modeline-vspc))
|
|
||||||
'mouse-face 'mode-line-highlight
|
|
||||||
'help-echo (get-text-property 1 'help-echo vc-mode)
|
|
||||||
'local-map (get-text-property 1 'local-map vc-mode))
|
|
||||||
(if active
|
(if active
|
||||||
text
|
icon
|
||||||
(propertize text 'face 'mode-line-inactive))
|
(propertize icon
|
||||||
(doom-modeline-spc)))))
|
'face `(:inherit ,(get-text-property 0 'face icon)
|
||||||
|
:inherit mode-line-inactive)))
|
||||||
|
(doom-modeline-vspc))
|
||||||
|
'mouse-face 'mode-line-highlight
|
||||||
|
'help-echo (get-text-property 1 'help-echo vc-mode)
|
||||||
|
'local-map (get-text-property 1 'local-map vc-mode))
|
||||||
|
(if active
|
||||||
|
text
|
||||||
|
(propertize text 'face 'mode-line-inactive))
|
||||||
|
(doom-modeline-spc)))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -725,7 +731,7 @@ mouse-2: Show help for minor mode")
|
||||||
('errored "Error")
|
('errored "Error")
|
||||||
('interrupted "Interrupted")
|
('interrupted "Interrupted")
|
||||||
('suspicious "Suspicious")))
|
('suspicious "Suspicious")))
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line down-mouse-1]
|
(define-key map [mode-line down-mouse-1]
|
||||||
flycheck-mode-menu-map)
|
flycheck-mode-menu-map)
|
||||||
|
@ -882,7 +888,7 @@ mouse-3: Next error"
|
||||||
mouse-1: Display minor mode menu
|
mouse-1: Display minor mode menu
|
||||||
mouse-2: Show help for minor mode"
|
mouse-2: Show help for minor mode"
|
||||||
(length running) (length known)))))
|
(length running) (length known)))))
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line down-mouse-1]
|
(define-key map [mode-line down-mouse-1]
|
||||||
flymake-menu)
|
flymake-menu)
|
||||||
|
@ -1207,13 +1213,16 @@ Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with
|
||||||
|
|
||||||
(defsubst doom-modeline--buffer-size ()
|
(defsubst doom-modeline--buffer-size ()
|
||||||
"Show buffer size."
|
"Show buffer size."
|
||||||
(if (and buffer-file-name size-indication-mode)
|
(concat
|
||||||
(propertize " %I "
|
(doom-modeline-spc)
|
||||||
'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive)
|
(if (and buffer-file-name size-indication-mode)
|
||||||
'help-echo "Buffer size
|
(propertize "%I"
|
||||||
|
'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive)
|
||||||
|
'help-echo "Buffer size
|
||||||
mouse-1: Display Line and Column Mode Menu"
|
mouse-1: Display Line and Column Mode Menu"
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map mode-line-column-line-number-mode-map)))
|
'local-map mode-line-column-line-number-mode-map))
|
||||||
|
(doom-modeline-spc)))
|
||||||
|
|
||||||
(doom-modeline-def-segment matches
|
(doom-modeline-def-segment matches
|
||||||
"Displays: 1. the currently recording macro, 2. A current/total for the
|
"Displays: 1. the currently recording macro, 2. A current/total for the
|
||||||
|
@ -1465,9 +1474,9 @@ See `mode-line-percent-position'.")
|
||||||
(let ((active (doom-modeline--active))
|
(let ((active (doom-modeline--active))
|
||||||
(lc '(line-number-mode
|
(lc '(line-number-mode
|
||||||
(column-number-mode
|
(column-number-mode
|
||||||
(doom-modeline-column-zero-based " %l:%c" " %l:%C")
|
(doom-modeline-column-zero-based "%l:%c" "%l:%C")
|
||||||
" %l")
|
"%l")
|
||||||
(column-number-mode (doom-modeline-column-zero-based " :%c" " :%C")))))
|
(column-number-mode (doom-modeline-column-zero-based ":%c" ":%C")))))
|
||||||
(if (and (bound-and-true-p nyan-mode)
|
(if (and (bound-and-true-p nyan-mode)
|
||||||
active
|
active
|
||||||
(>= (window-width) nyan-minimum-window-width))
|
(>= (window-width) nyan-minimum-window-width))
|
||||||
|
@ -1478,21 +1487,20 @@ See `mode-line-percent-position'.")
|
||||||
(propertize (format-mode-line lc)
|
(propertize (format-mode-line lc)
|
||||||
'help-echo "Buffer position\n\
|
'help-echo "Buffer position\n\
|
||||||
mouse-1: Display Line and Column Mode Menu"
|
mouse-1: Display Line and Column Mode Menu"
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map mode-line-column-line-number-mode-map))
|
'local-map mode-line-column-line-number-mode-map))
|
||||||
(propertize
|
(concat (doom-modeline-spc)
|
||||||
(concat (doom-modeline-spc)
|
(doom-modeline-spc)
|
||||||
(format-mode-line lc)
|
(propertize (concat (format-mode-line lc)
|
||||||
(if doom-modeline-percent-position
|
(when doom-modeline-percent-position
|
||||||
(format-mode-line '(" " doom-modeline-percent-position "%%")))
|
(format-mode-line '(" " doom-modeline-percent-position "%%"))))
|
||||||
(if (or line-number-mode
|
'face (if active 'mode-line 'mode-line-inactive)
|
||||||
column-number-mode doom-modeline-percent-position)
|
'help-echo "Buffer position\n\
|
||||||
(doom-modeline-spc)))
|
|
||||||
'face (if active 'mode-line 'mode-line-inactive)
|
|
||||||
'help-echo "Buffer position\n\
|
|
||||||
mouse-1: Display Line and Column Mode Menu"
|
mouse-1: Display Line and Column Mode Menu"
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map mode-line-column-line-number-mode-map))))
|
'local-map mode-line-column-line-number-mode-map)
|
||||||
|
(when (or line-number-mode column-number-mode doom-modeline-percent-position)
|
||||||
|
(doom-modeline-spc))))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; party parrot
|
;; party parrot
|
||||||
|
@ -1720,7 +1728,7 @@ mouse-2: Quit server
|
||||||
mouse-3: Reconnect to server")
|
mouse-3: Reconnect to server")
|
||||||
"LSP Disconnected
|
"LSP Disconnected
|
||||||
mouse-1: Reload to start server")
|
mouse-1: Reload to start server")
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(if workspaces
|
(if workspaces
|
||||||
(progn
|
(progn
|
||||||
|
@ -1776,7 +1784,7 @@ mouse-1: Display server events
|
||||||
mouse-2: Quit server
|
mouse-2: Quit server
|
||||||
mouse-3: Reconnect to server" nick (eglot--major-mode server)))
|
mouse-3: Reconnect to server" nick (eglot--major-mode server)))
|
||||||
(t "EGLOT Disconnected"))
|
(t "EGLOT Disconnected"))
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(cond (last-error
|
(cond (last-error
|
||||||
(define-key map [mode-line mouse-3]
|
(define-key map [mode-line mouse-3]
|
||||||
|
@ -1898,7 +1906,7 @@ Example:
|
||||||
'help-echo "Github Notifications
|
'help-echo "Github Notifications
|
||||||
mouse-1: Show notifications
|
mouse-1: Show notifications
|
||||||
mouse-3: Fetch notifications"
|
mouse-3: Fetch notifications"
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line mouse-1]
|
(define-key map [mode-line mouse-1]
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
@ -1935,7 +1943,7 @@ mouse-1: Display debug hydra
|
||||||
mouse-2: Display recent configurations
|
mouse-2: Display recent configurations
|
||||||
mouse-3: Disconnect session"
|
mouse-3: Disconnect session"
|
||||||
(dap-mode-line))
|
(dap-mode-line))
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line mouse-1]
|
(define-key map [mode-line mouse-1]
|
||||||
#'dap-hydra)
|
#'dap-hydra)
|
||||||
|
@ -1955,7 +1963,7 @@ mouse-1: Show help
|
||||||
mouse-2: Next
|
mouse-2: Next
|
||||||
mouse-3: Stop debugging"
|
mouse-3: Stop debugging"
|
||||||
edebug-execution-mode)
|
edebug-execution-mode)
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line mouse-1]
|
(define-key map [mode-line mouse-1]
|
||||||
#'edebug-help)
|
#'edebug-help)
|
||||||
|
@ -1971,7 +1979,7 @@ mouse-3: Stop debugging"
|
||||||
(propertize (doom-modeline-debug-icon 'doom-modeline-urgent)
|
(propertize (doom-modeline-debug-icon 'doom-modeline-urgent)
|
||||||
'help-echo "Debug on Error
|
'help-echo "Debug on Error
|
||||||
mouse-1: Toggle Debug on Error"
|
mouse-1: Toggle Debug on Error"
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-error))))
|
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-error))))
|
||||||
|
|
||||||
(defsubst doom-modeline--debug-on-quit ()
|
(defsubst doom-modeline--debug-on-quit ()
|
||||||
|
@ -1980,7 +1988,7 @@ mouse-1: Toggle Debug on Error"
|
||||||
(propertize (doom-modeline-debug-icon 'doom-modeline-info)
|
(propertize (doom-modeline-debug-icon 'doom-modeline-info)
|
||||||
'help-echo "Debug on Quit
|
'help-echo "Debug on Quit
|
||||||
mouse-1: Toggle Debug on Quit"
|
mouse-1: Toggle Debug on Quit"
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-quit))))
|
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-quit))))
|
||||||
|
|
||||||
(doom-modeline-def-segment debug
|
(doom-modeline-def-segment debug
|
||||||
|
@ -2044,7 +2052,7 @@ mouse-1: Toggle Debug on Quit"
|
||||||
(format "%d+" doom-modeline-number-limit)
|
(format "%d+" doom-modeline-number-limit)
|
||||||
(number-to-string mu4e-alert-mode-line))
|
(number-to-string mu4e-alert-mode-line))
|
||||||
'face '(:inherit (doom-modeline-warning doom-modeline-unread-number))))
|
'face '(:inherit (doom-modeline-warning doom-modeline-unread-number))))
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'help-echo (if (= mu4e-alert-mode-line 1)
|
'help-echo (if (= mu4e-alert-mode-line 1)
|
||||||
"You have an unread email"
|
"You have an unread email"
|
||||||
(format "You have %s unread emails" mu4e-alert-mode-line)))
|
(format "You have %s unread emails" mu4e-alert-mode-line)))
|
||||||
|
@ -2413,7 +2421,7 @@ The cdr can also be a function that returns a name to use.")
|
||||||
mouse-1: Open browser
|
mouse-1: Open browser
|
||||||
mouse-2: Stop preview"
|
mouse-2: Stop preview"
|
||||||
grip-port)
|
grip-port)
|
||||||
'mouse-face '(:box 0)
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line mouse-1]
|
(define-key map [mode-line mouse-1]
|
||||||
#'grip-browse-preview)
|
#'grip-browse-preview)
|
||||||
|
|
Loading…
Add table
Reference in a new issue