summaryrefslogtreecommitdiff
path: root/modeline.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2020-12-22 20:35:51 +0800
committerJSDurand <mmemmew@gmail.com>2020-12-22 20:35:51 +0800
commit7c16649462beca822c0b72438a2b20e77a261985 (patch)
treec24981bb691e53fa0a2b0089a40de5938b0fb6a4 /modeline.el
Initial commit
Diffstat (limited to 'modeline.el')
-rw-r--r--modeline.el66
1 files changed, 66 insertions, 0 deletions
diff --git a/modeline.el b/modeline.el
new file mode 100644
index 0000000..a564a10
--- /dev/null
+++ b/modeline.el
@@ -0,0 +1,66 @@
+;;;###autoload
+(defun modeline-format-main ()
+ "The main mode line format."
+ (let ((left (modeline-format-left))
+ (right (modeline-format-right))
+ (left-len (length left))
+ (right-len (length right))
+ (middle (propertize " " 'display
+ (make-string (- (window-width)
+ left-len
+ right-len)
+ 32))))
+ (concat left middle right)))
+
+;;;###autoload
+(defun modeline-format-left ()
+ "The left mode line format."
+ )
+
+;;;###autoload
+(defvar modeline-bar-width 3
+ "The width of the mode line bar")
+
+;;;###autoload
+(defvar modeline-bar-height 27
+ "The height of the mode line bar")
+
+;;;###autoload
+(defun modeline-format-bar ()
+ "We need a bar to ensure the mode line has the specified height."
+ (cond
+ ((and (display-graphic-p)
+ (image-type-available-p 'xpm))
+ (propertize
+ " " 'display
+ (let ((data (make-list modeline-bar-height
+ (make-list modeline-bar-width 97)))
+ (color (face-background 'modus-theme-active-blue nil t)))
+ (ignore-errors
+ (create-image
+ (concat
+ "/* XPM */\nstatic char * bar[]={\n"
+ (format "\"%d %d 1 1\",\n\"a c %s\",\n"
+ modeline-bar-width modeline-bar-height
+ color)
+ (mapconcat
+ (lambda (row)
+ (format "\"%s\""
+ (apply #'string row)))
+ data ",\n")
+ "\n};")
+ 'xpm t :ascent 'center)))))))
+
+;;;###autoload
+(defun modeline-format-right ()
+ "The right mode line format.")
+
+
+
+
+
+
+
+(setq mode-line-format '("%e" (:eval (modeline-format-main))))
+
+