Refactor client segment
The client status indicator will be propertized with its own face. The buffer status indicator and default mood-line-format configurations have also been adjusted to make room for the new client status indicator.
This commit is contained in:
parent
eb3993601d
commit
a9b55d8308
57
mood-line.el
57
mood-line.el
@ -144,7 +144,7 @@ An optional key :padding may be provided, the value of which will be used as
|
|||||||
(:buffer-modified . ?*)
|
(:buffer-modified . ?*)
|
||||||
(:buffer-read-only . ?#)
|
(:buffer-read-only . ?#)
|
||||||
|
|
||||||
(:emacsclient . ?c)
|
(:frame-client . ?@)
|
||||||
|
|
||||||
(:count-separator . ?*))
|
(:count-separator . ?*))
|
||||||
"Set of ASCII glyphs for use with mood-line.")
|
"Set of ASCII glyphs for use with mood-line.")
|
||||||
@ -167,7 +167,7 @@ An optional key :padding may be provided, the value of which will be used as
|
|||||||
(:buffer-modified . ?●)
|
(:buffer-modified . ?●)
|
||||||
(:buffer-read-only . ?■)
|
(:buffer-read-only . ?■)
|
||||||
|
|
||||||
(:emacsclient . ?▶)
|
(:frame-client . ?)
|
||||||
|
|
||||||
(:count-separator . ?×))
|
(:count-separator . ?×))
|
||||||
"Set of Fira Code-compatible glyphs for use with mood-line.")
|
"Set of Fira Code-compatible glyphs for use with mood-line.")
|
||||||
@ -190,7 +190,7 @@ An optional key :padding may be provided, the value of which will be used as
|
|||||||
(:buffer-modified . ?●)
|
(:buffer-modified . ?●)
|
||||||
(:buffer-read-only . ?■)
|
(:buffer-read-only . ?■)
|
||||||
|
|
||||||
(:emacsclient . ?↹)
|
(:frame-client . ?⇅)
|
||||||
|
|
||||||
(:count-separator . ?✕))
|
(:count-separator . ?✕))
|
||||||
"Set of Unicode glyphs for use with mood-line.")
|
"Set of Unicode glyphs for use with mood-line.")
|
||||||
@ -198,12 +198,12 @@ An optional key :padding may be provided, the value of which will be used as
|
|||||||
(defconst mood-line-format-default
|
(defconst mood-line-format-default
|
||||||
(mood-line-defformat
|
(mood-line-defformat
|
||||||
:left
|
:left
|
||||||
(((mood-line-segment-modal) . " ")
|
(((mood-line-segment-modal) . " ")
|
||||||
((mood-line-segment-buffer-status) . " ")
|
((or (mood-line-segment-buffer-status) " ") . " ")
|
||||||
((mood-line-segment-buffer-name) . " ")
|
((mood-line-segment-buffer-name) . " ")
|
||||||
((mood-line-segment-anzu) . " ")
|
((mood-line-segment-anzu) . " ")
|
||||||
((mood-line-segment-multiple-cursors) . " ")
|
((mood-line-segment-multiple-cursors) . " ")
|
||||||
((mood-line-segment-cursor-position) . " ")
|
((mood-line-segment-cursor-position) . " ")
|
||||||
(mood-line-segment-scroll))
|
(mood-line-segment-scroll))
|
||||||
:right
|
:right
|
||||||
(((mood-line-segment-vc) . " ")
|
(((mood-line-segment-vc) . " ")
|
||||||
@ -217,7 +217,9 @@ An optional key :padding may be provided, the value of which will be used as
|
|||||||
(mood-line-defformat
|
(mood-line-defformat
|
||||||
:left
|
:left
|
||||||
(((mood-line-segment-modal) . " ")
|
(((mood-line-segment-modal) . " ")
|
||||||
((mood-line-segment-buffer-status) . " ")
|
((or (mood-line-segment-buffer-status)
|
||||||
|
(mood-line-segment-client)
|
||||||
|
" ") . " ")
|
||||||
((mood-line-segment-buffer-name) . " ")
|
((mood-line-segment-buffer-name) . " ")
|
||||||
((mood-line-segment-anzu) . " ")
|
((mood-line-segment-anzu) . " ")
|
||||||
((mood-line-segment-multiple-cursors) . " ")
|
((mood-line-segment-multiple-cursors) . " ")
|
||||||
@ -294,7 +296,7 @@ Keys are names for different mode line glyphs, values are characters for that
|
|||||||
:buffer-modified | File-backed buffer is modified
|
:buffer-modified | File-backed buffer is modified
|
||||||
:buffer-read-only | File-backed buffer is read-only
|
:buffer-read-only | File-backed buffer is read-only
|
||||||
|
|
||||||
:emacsclient | Frame is a client for an Emacs daemon
|
:frame-client | Frame is a client for an Emacs daemon
|
||||||
|
|
||||||
:count-separator | Separates some indicator names from numerical counts
|
:count-separator | Separates some indicator names from numerical counts
|
||||||
|
|
||||||
@ -352,6 +354,10 @@ See `mood-line-defformat' for a helpful formatting macro."
|
|||||||
"Face used for the ':buffer-narrowed' buffer status indicator."
|
"Face used for the ':buffer-narrowed' buffer status indicator."
|
||||||
:group 'mood-line-faces)
|
:group 'mood-line-faces)
|
||||||
|
|
||||||
|
(defface mood-line-frame-status-client
|
||||||
|
'((t (:inherit shadow :weight normal)))
|
||||||
|
"Face used for the :frame-client frame status indicator.")
|
||||||
|
|
||||||
(defface mood-line-major-mode
|
(defface mood-line-major-mode
|
||||||
'((t (:inherit bold)))
|
'((t (:inherit bold)))
|
||||||
"Face used for the major mode indicator."
|
"Face used for the major mode indicator."
|
||||||
@ -512,16 +518,17 @@ Modal modes checked, in order: `evil-mode', `meow-mode', `god-mode'."
|
|||||||
((bound-and-true-p flymake-mode)
|
((bound-and-true-p flymake-mode)
|
||||||
mood-line-segment-checker--flymake-text)))
|
mood-line-segment-checker--flymake-text)))
|
||||||
|
|
||||||
;; ---------------------------------- ;;
|
;; -------------------------------------------------------------------------- ;;
|
||||||
;; Emacsclient segment function
|
;;
|
||||||
;; ---------------------------------- ;;
|
;; Client segment
|
||||||
|
;;
|
||||||
|
;; -------------------------------------------------------------------------- ;;
|
||||||
|
|
||||||
(defun mood-line-segment-emacsclient ()
|
(defun mood-line-segment-client ()
|
||||||
"Indicate whether or not the frame is an emacsclient."
|
"Return an indicator representing the client status of the current frame."
|
||||||
(if (not (eq (format-mode-line mode-line-client) ""))
|
(when (frame-parameter nil 'client)
|
||||||
(format #("%s " 0 1 (face mood-line-status-info))
|
(propertize (mood-line--get-glyph :frame-client)
|
||||||
(mood-line--get-glyph :emacsclient))
|
'face 'mood-line-frame-status-client)))
|
||||||
""))
|
|
||||||
|
|
||||||
;; -------------------------------------------------------------------------- ;;
|
;; -------------------------------------------------------------------------- ;;
|
||||||
;;
|
;;
|
||||||
@ -592,12 +599,10 @@ Modal modes checked, in order: `evil-mode', `meow-mode', `god-mode'."
|
|||||||
'face 'mood-line-buffer-status-modified))
|
'face 'mood-line-buffer-status-modified))
|
||||||
(buffer-read-only
|
(buffer-read-only
|
||||||
(propertize (mood-line--get-glyph :buffer-read-only)
|
(propertize (mood-line--get-glyph :buffer-read-only)
|
||||||
'face 'mood-line-buffer-status-read-only))
|
'face 'mood-line-buffer-status-read-only)))
|
||||||
(t " "))
|
(when (buffer-narrowed-p)
|
||||||
(if (buffer-narrowed-p)
|
(propertize (mood-line--get-glyph :buffer-narrowed)
|
||||||
(propertize (mood-line--get-glyph :buffer-narrowed)
|
'face 'mood-line-buffer-status-narrowed))))
|
||||||
'face 'mood-line-buffer-status-narrowed)
|
|
||||||
" ")))
|
|
||||||
|
|
||||||
;; ---------------------------------- ;;
|
;; ---------------------------------- ;;
|
||||||
;; Buffer name segment
|
;; Buffer name segment
|
||||||
|
Loading…
Reference in New Issue
Block a user