Add more statusbar components

This commit is contained in:
Sameer Rahmani 2021-12-14 19:52:35 +00:00
parent f063883f6c
commit 246fc233d5
5 changed files with 172 additions and 86 deletions

View File

@ -246,10 +246,9 @@
(let ((mline (or (plist-get fg42/editor-cube-params :modeline)
#'fg42/default-modeline)))
(fg42/statusbar-cube)
;; (fg42/modeline-cube)
(fg42/setup-modeline-format mline)
)
;;(fg42/statusbar-cube)
(fg42/modeline-cube)
(fg42/setup-modeline-format mline))
(fg42/font-cube)
(fg42/pinentry-cube)

View File

@ -39,10 +39,25 @@
:flag-default t)
(defun fg42/mini-modeline-setter (def)
(let ((def-list (func def)))
(if (null def)
(let ((def-list (funcall def)))
(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 (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
:straight (smart-mode-line :source melpa)

View File

@ -53,24 +53,90 @@ thresholds ERR adn WARN"
(propertize (format "%02d" m) 'face (fg42/percentage-face m 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
(defface fg42/statusbar-project-face
'((t :inherit font-lock-type-face :bold t))
"Project name face on status bar"
:group 'fg42/statusbar)
(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
(if (display-graphic-p)
(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
)
;; 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
:brief (list
'fg42/statusbar-battery
;;'(buffer-name)
;;'fg42/statusbar-battery
'fg42/statusbar-memory
"|" '(buffer-name) "|" '(format-mode-line "%l:%c") "|" '(format-time-string "%m-%d %H:%M"))
'(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
(list
:brief (list)
:long "")))
)
(provide 'fg42/modeline/statusbar-default)

View File

@ -47,7 +47,5 @@
(funcall fg42/modeline-setter definition))
(provide 'fg42/modeline)
;;; modeline.el ends here

View File

@ -78,6 +78,8 @@ Nil means current selected frame."
:group 'fg42/statusbar)
(defvar fg42/statusbar-height 4)
(defcustom fg42/statusbar-face-attr `(:background ,(face-attribute 'mode-line :background))
"Plist of face attribute/value pair for fg42/statusbar."
:type '(plist)
@ -89,9 +91,15 @@ Nil means current selected frame."
(defface fg42/statusbar-mode-line
'((((background light))
:background "#55ced1" :height 0.14 :box nil)
:background "#55ced1" :height 0.1 :box nil)
(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."
:group 'fg42/statusbar)
@ -360,7 +368,7 @@ that runs the given BODY at the given INTERVAL."
(when (> (length result) 0)
result)))
fg42/statusbar-components
" "))
""))
(defun fg42/statusbar-get-frame-width ()
@ -410,7 +418,7 @@ as `snails'."
When ARG is:
- `force', force update the minibuffer.
- `clear', clear the minibuffer. This implies `force'."
(save-match-data
(save-match-data
(let ((bar-info (fg42/statusbar-build-active-info)))
(condition-case err