Add more statusbar components
This commit is contained in:
parent
f063883f6c
commit
246fc233d5
|
@ -246,10 +246,9 @@
|
||||||
|
|
||||||
(let ((mline (or (plist-get fg42/editor-cube-params :modeline)
|
(let ((mline (or (plist-get fg42/editor-cube-params :modeline)
|
||||||
#'fg42/default-modeline)))
|
#'fg42/default-modeline)))
|
||||||
(fg42/statusbar-cube)
|
;;(fg42/statusbar-cube)
|
||||||
;; (fg42/modeline-cube)
|
(fg42/modeline-cube)
|
||||||
(fg42/setup-modeline-format mline)
|
(fg42/setup-modeline-format mline))
|
||||||
)
|
|
||||||
|
|
||||||
(fg42/font-cube)
|
(fg42/font-cube)
|
||||||
(fg42/pinentry-cube)
|
(fg42/pinentry-cube)
|
||||||
|
|
|
@ -39,10 +39,25 @@
|
||||||
:flag-default t)
|
:flag-default t)
|
||||||
|
|
||||||
(defun fg42/mini-modeline-setter (def)
|
(defun fg42/mini-modeline-setter (def)
|
||||||
(let ((def-list (func def)))
|
(if (null def)
|
||||||
(setq-default mini-modeline-l-format (plist-get def-list :long))
|
(let ((def-list (funcall def)))
|
||||||
(setq-default mini-modeline-r-format (plist-get def-list :brief))))
|
(setq-default mini-modeline-l-format (plist-get def-list :long))
|
||||||
|
(setq-default mini-modeline-r-format (plist-get def-list :brief)))
|
||||||
|
|
||||||
|
(setq-default
|
||||||
|
mini-modeline-r-format
|
||||||
|
'("%e"
|
||||||
|
mode-line-front-space
|
||||||
|
mode-line-mule-info
|
||||||
|
mode-line-client
|
||||||
|
mode-line-modified
|
||||||
|
mode-line-remote
|
||||||
|
mode-line-frame-identification
|
||||||
|
mode-line-buffer-identification
|
||||||
|
mode-line-position
|
||||||
|
evil-mode-line-tag
|
||||||
|
(:eval (string-trim (format-mode-line mode-line-modes)))
|
||||||
|
mode-line-misc-info ))))
|
||||||
|
|
||||||
(fpkg/use smart-mode-line
|
(fpkg/use smart-mode-line
|
||||||
:straight (smart-mode-line :source melpa)
|
:straight (smart-mode-line :source melpa)
|
||||||
|
|
|
@ -53,24 +53,90 @@ thresholds ERR adn WARN"
|
||||||
(propertize (format "%02d" m) 'face (fg42/percentage-face m 90 75))
|
(propertize (format "%02d" m) 'face (fg42/percentage-face m 90 75))
|
||||||
(propertize (format "%02d" s) 'face (fg42/percentage-face s 90 75)))))
|
(propertize (format "%02d" s) 'face (fg42/percentage-face s 90 75)))))
|
||||||
|
|
||||||
;; The default modeline for FG42 that is compatible with
|
|
||||||
;; the FG42's status bar only
|
|
||||||
(defmode-line fg42/statusbar-default
|
|
||||||
(if (display-graphic-p)
|
|
||||||
(progn
|
|
||||||
;; We are in the graphical world
|
|
||||||
(require 'all-the-icons)
|
|
||||||
|
|
||||||
(list
|
(defface fg42/statusbar-project-face
|
||||||
:brief (list
|
'((t :inherit font-lock-type-face :bold t))
|
||||||
'fg42/statusbar-battery
|
"Project name face on status bar"
|
||||||
'fg42/statusbar-memory
|
:group 'fg42/statusbar)
|
||||||
"|" '(buffer-name) "|" '(format-mode-line "%l:%c") "|" '(format-time-string "%m-%d %H:%M"))
|
|
||||||
:long " "))
|
(defface fg42/statusbar-buffer-name-face
|
||||||
|
'((t :inherit font-lock-variable-name-face))
|
||||||
|
"Buffer name face on status line"
|
||||||
|
:group 'fg42/statusbar)
|
||||||
|
|
||||||
|
|
||||||
|
(defun fg42/statusbar-project-name ()
|
||||||
|
(when-flag projectile
|
||||||
|
(projectile-project-name)))
|
||||||
|
|
||||||
|
|
||||||
|
(defun fg42/statusbar-buffer-and-project ()
|
||||||
|
(format "%s:%s"
|
||||||
|
(propertize (fg42/statusbar-project-name) 'face 'fg42/statusbar-project-face)
|
||||||
|
(propertize (buffer-name) 'face 'fg42/statusbar-buffer-name-face)))
|
||||||
|
|
||||||
|
;; (defvar fg42/statusbar-git-branch "-")
|
||||||
|
;; (defvar fg42/statusbar--last-branch "-")
|
||||||
|
|
||||||
|
|
||||||
|
;; (defun fg42/statusbar-update-git-branch()
|
||||||
|
;; (message "eeoeeeeee")
|
||||||
|
;; (setq fg42/statusbar-git-branch
|
||||||
|
;; (shell-command-to-string "git symbolic-ref --short HEAD")))
|
||||||
|
|
||||||
|
;; (defun fg42/statusbar-setup-git-branch-updater ()
|
||||||
|
;; ;;(add-function :after after-focus-change-function #'fg42/statusbar-update-git-branch)
|
||||||
|
;; (advice-add :after 'ace-select-window #'fg42/statusbar-update-git-branch)
|
||||||
|
|
||||||
|
;; 'fg42/statusbar-git-branch)
|
||||||
|
|
||||||
|
|
||||||
|
(defmode-line fg42/statusbar-default
|
||||||
|
(list
|
||||||
|
:brief (list
|
||||||
|
;;'(buffer-name)
|
||||||
|
;;'fg42/statusbar-battery
|
||||||
|
|
||||||
|
"|"
|
||||||
|
'(substring-no-properties (vc-mode vc-mode))
|
||||||
|
"|"
|
||||||
|
'(fg42/statusbar-buffer-and-project)
|
||||||
|
"|"
|
||||||
|
'fg42/statusbar-memory
|
||||||
|
"|"
|
||||||
|
'(format-mode-line "%03l:%02c")
|
||||||
|
|
||||||
|
;;'(format-time-string "%m-%d %H:%M")
|
||||||
|
;; (let ((bar (format "%s" fg42/statusbar-memory))) (add-text-properties 0 (string-width bar) (cons 'face (cons '(:size 0.3) (or (get-text-property 0 'face bar) 'default-face))) bar)
|
||||||
|
;; bar)
|
||||||
|
)
|
||||||
|
:long " ")
|
||||||
;; No GUI
|
;; No GUI
|
||||||
|
|
||||||
|
)
|
||||||
|
;; The default modeline for FG42 WM that is compatible with
|
||||||
|
;; the FG42's status bar only
|
||||||
|
(defmode-line fg42/statusbar-default-wm
|
||||||
|
(progn
|
||||||
|
;; We are in the graphical world
|
||||||
|
(require 'all-the-icons)
|
||||||
|
;;(format "%s|%s|%s|%s|%s")
|
||||||
(list
|
(list
|
||||||
:brief (list)
|
:brief (list
|
||||||
:long "")))
|
;;'(buffer-name)
|
||||||
|
;;'fg42/statusbar-battery
|
||||||
|
|
||||||
|
'fg42/statusbar-memory
|
||||||
|
'(format-mode-line "%03l:%02c")
|
||||||
|
|
||||||
|
;;'(format-time-string "%m-%d %H:%M")
|
||||||
|
;; (let ((bar (format "%s" fg42/statusbar-memory))) (add-text-properties 0 (string-width bar) (cons 'face (cons '(:size 0.3) (or (get-text-property 0 'face bar) 'default-face))) bar)
|
||||||
|
;; bar)
|
||||||
|
)
|
||||||
|
:long " "))
|
||||||
|
;; No GUI
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
(provide 'fg42/modeline/statusbar-default)
|
(provide 'fg42/modeline/statusbar-default)
|
||||||
|
|
|
@ -47,7 +47,5 @@
|
||||||
(funcall fg42/modeline-setter definition))
|
(funcall fg42/modeline-setter definition))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'fg42/modeline)
|
(provide 'fg42/modeline)
|
||||||
;;; modeline.el ends here
|
;;; modeline.el ends here
|
||||||
|
|
|
@ -78,6 +78,8 @@ Nil means current selected frame."
|
||||||
:group 'fg42/statusbar)
|
:group 'fg42/statusbar)
|
||||||
|
|
||||||
|
|
||||||
|
(defvar fg42/statusbar-height 4)
|
||||||
|
|
||||||
(defcustom fg42/statusbar-face-attr `(:background ,(face-attribute 'mode-line :background))
|
(defcustom fg42/statusbar-face-attr `(:background ,(face-attribute 'mode-line :background))
|
||||||
"Plist of face attribute/value pair for fg42/statusbar."
|
"Plist of face attribute/value pair for fg42/statusbar."
|
||||||
:type '(plist)
|
:type '(plist)
|
||||||
|
@ -89,21 +91,27 @@ Nil means current selected frame."
|
||||||
|
|
||||||
(defface fg42/statusbar-mode-line
|
(defface fg42/statusbar-mode-line
|
||||||
'((((background light))
|
'((((background light))
|
||||||
:background "#55ced1" :height 0.14 :box nil)
|
:background "#55ced1" :height 0.1 :box nil)
|
||||||
(t
|
(t
|
||||||
:background "#008b8b" :height 0.14 :box nil))
|
:background "#3f3f3f" :height 0.2 :box nil))
|
||||||
|
|
||||||
|
"Modeline face for active window."
|
||||||
|
:group 'fg42/statusbar)
|
||||||
|
|
||||||
|
(defface fg42/statusbar-components
|
||||||
|
'((t :inherit t :height 0.7))
|
||||||
|
|
||||||
"Modeline face for active window."
|
"Modeline face for active window."
|
||||||
:group 'fg42/statusbar)
|
:group 'fg42/statusbar)
|
||||||
|
|
||||||
|
|
||||||
(defface fg42/statusbar-mode-line-inactive
|
(defface fg42/statusbar-mode-line-inactive
|
||||||
'((((background light))
|
'((((background light))
|
||||||
:background "#dddddd" :height 0.1 :box nil)
|
:background "#dddddd" :height 0.1 :box nil)
|
||||||
(t
|
(t
|
||||||
:background "#333333" :height 0.1 :box nil))
|
:background "#333333" :height 0.1 :box nil))
|
||||||
"Modeline face for inactive window."
|
"Modeline face for inactive window."
|
||||||
:group 'fg42/statusbar)
|
:group 'fg42/statusbar)
|
||||||
|
|
||||||
|
|
||||||
;; ============================================================================
|
;; ============================================================================
|
||||||
|
@ -360,7 +368,7 @@ that runs the given BODY at the given INTERVAL."
|
||||||
(when (> (length result) 0)
|
(when (> (length result) 0)
|
||||||
result)))
|
result)))
|
||||||
fg42/statusbar-components
|
fg42/statusbar-components
|
||||||
" "))
|
""))
|
||||||
|
|
||||||
|
|
||||||
(defun fg42/statusbar-get-frame-width ()
|
(defun fg42/statusbar-get-frame-width ()
|
||||||
|
@ -410,61 +418,61 @@ as `snails'."
|
||||||
When ARG is:
|
When ARG is:
|
||||||
- `force', force update the minibuffer.
|
- `force', force update the minibuffer.
|
||||||
- `clear', clear the minibuffer. This implies `force'."
|
- `clear', clear the minibuffer. This implies `force'."
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(let ((bar-info (fg42/statusbar-build-active-info)))
|
(let ((bar-info (fg42/statusbar-build-active-info)))
|
||||||
(condition-case err
|
(condition-case err
|
||||||
|
|
||||||
(cl-letf (((symbol-function 'completion-all-completions) #'ignore))
|
(cl-letf (((symbol-function 'completion-all-completions) #'ignore))
|
||||||
(unless (or (active-minibuffer-window)
|
(unless (or (active-minibuffer-window)
|
||||||
(input-pending-p))
|
(input-pending-p))
|
||||||
(setq fg42/statusbar--minibuffer
|
(setq fg42/statusbar--minibuffer
|
||||||
(window-buffer (minibuffer-window fg42/statusbar-frame)))
|
(window-buffer (minibuffer-window fg42/statusbar-frame)))
|
||||||
(with-current-buffer fg42/statusbar--minibuffer
|
(with-current-buffer fg42/statusbar--minibuffer
|
||||||
(let ((truncate-lines fg42/statusbar-truncate-p)
|
(let ((truncate-lines fg42/statusbar-truncate-p)
|
||||||
(inhibit-read-only t)
|
(inhibit-read-only t)
|
||||||
(inhibit-redisplay t)
|
(inhibit-redisplay t)
|
||||||
(buffer-undo-list t)
|
(buffer-undo-list t)
|
||||||
modeline-content)
|
modeline-content)
|
||||||
(when (or (memq arg '(force clear))
|
(when (or (memq arg '(force clear))
|
||||||
(fg42/statusbar--overduep fg42/statusbar--last-update
|
(fg42/statusbar--overduep fg42/statusbar--last-update
|
||||||
fg42/statusbar-refresh-idle-delay))
|
fg42/statusbar-refresh-idle-delay))
|
||||||
(when-let ((msg (or fg42/statusbar--msg-message (current-message))))
|
(when-let ((msg (or fg42/statusbar--msg-message (current-message))))
|
||||||
;; Clear echo area and start new timer for echo message
|
;; Clear echo area and start new timer for echo message
|
||||||
(message nil)
|
(message nil)
|
||||||
(setq fg42/statusbar--last-echoed (current-time))
|
(setq fg42/statusbar--last-echoed (current-time))
|
||||||
;; we proritize the message from `message'
|
;; we proritize the message from `message'
|
||||||
;; or the message when we're not in middle of a command running.
|
;; or the message when we're not in middle of a command running.
|
||||||
(when (or fg42/statusbar--msg-message
|
(when (or fg42/statusbar--msg-message
|
||||||
(eq fg42/statusbar-command-state 'begin))
|
(eq fg42/statusbar-command-state 'begin))
|
||||||
(setq fg42/statusbar-command-state 'exec)
|
(setq fg42/statusbar-command-state 'exec)
|
||||||
;; Don't echo keystrokes when in middle of command
|
;; Don't echo keystrokes when in middle of command
|
||||||
(setq echo-keystrokes 0))
|
(setq echo-keystrokes 0))
|
||||||
(setq fg42/statusbar--msg msg))
|
(setq fg42/statusbar--msg msg))
|
||||||
;; Reset echo message when timeout and not in middle of command
|
;; Reset echo message when timeout and not in middle of command
|
||||||
(when (and fg42/statusbar--msg
|
(when (and fg42/statusbar--msg
|
||||||
(not (memq fg42/statusbar-command-state '(exec exec-read)))
|
(not (memq fg42/statusbar-command-state '(exec exec-read)))
|
||||||
(fg42/statusbar--overduep fg42/statusbar--last-echoed
|
(fg42/statusbar--overduep fg42/statusbar--last-echoed
|
||||||
fg42/statusbar-echo-duration))
|
fg42/statusbar-echo-duration))
|
||||||
(setq fg42/statusbar--msg nil))
|
(setq fg42/statusbar--msg nil))
|
||||||
;; Showing fg42/statusbar
|
;; Showing fg42/statusbar
|
||||||
(if (eq arg 'clear)
|
(if (eq arg 'clear)
|
||||||
(setq modeline-content nil)
|
(setq modeline-content nil)
|
||||||
(setq modeline-content
|
(setq modeline-content
|
||||||
(fg42/statusbar-get-echo-format-string bar-info fg42/statusbar--msg))
|
(fg42/statusbar-get-echo-format-string bar-info fg42/statusbar--msg))
|
||||||
(setq fg42/statusbar--last-update (current-time)))
|
(setq fg42/statusbar--last-update (current-time)))
|
||||||
|
|
||||||
;; write to minibuffer
|
;; write to minibuffer
|
||||||
(unless (equal modeline-content
|
(unless (equal modeline-content
|
||||||
fg42/statusbar--cache))
|
fg42/statusbar--cache))
|
||||||
(setq fg42/statusbar--cache modeline-content)
|
(setq fg42/statusbar--cache modeline-content)
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(when fg42/statusbar--cache
|
(when fg42/statusbar--cache
|
||||||
(let (
|
(let (
|
||||||
;;let fg42/statusbar take control of mini-buffer size
|
;;let fg42/statusbar take control of mini-buffer size
|
||||||
(resize-mini-windows t))
|
(resize-mini-windows t))
|
||||||
(insert fg42/statusbar--cache))))))))
|
(insert fg42/statusbar--cache))))))))
|
||||||
((error debug)
|
((error debug)
|
||||||
(fg42/statusbar--log "fg42/statusbar: %s\n" err))))))
|
(fg42/statusbar--log "fg42/statusbar: %s\n" err))))))
|
||||||
|
|
||||||
|
|
||||||
(defun fg42/statusbar-message-advice (f &rest args)
|
(defun fg42/statusbar-message-advice (f &rest args)
|
||||||
|
|
Loading…
Reference in New Issue