;;; Code:
+;; A windows may have six kinds different mode-line
+;; type = 1.
+;; -----------------------------
+;; |>>> O <<<|
+;; -----------------------------
+
(defun my-get-window-type ()
"According to the window layout, separate the windows as six types.
Each type will have different mode line. This function return the defined
window type."
- (if
- (and
- (not (window-in-direction 'right nil t -1))
- (not (window-in-direction 'left nil t -1))
- (not (window-in-direction 'below nil t 1)))
- 1
- (if
- (and
- (window-in-direction 'right nil t -1)
- (not (window-in-direction 'left nil t -1))
- (not (window-in-direction 'below nil t 1)))
- 2
- (if
- (and
- (not (window-in-direction 'right nil t -1))
- (window-in-direction 'left nil t -1)
- (not (window-in-direction 'below nil t 1)))
- 3
- (if
- (and
- (window-in-direction 'right nil t -1)
- (not (window-in-direction 'left nil t -1))
- (window-in-direction 'below nil t 1))
- 5
- (if
- (and
- (not (window-in-direction 'right nil t -1))
- (window-in-direction 'left nil t -1)
- (window-in-direction 'below ni t 1))
- 6
- 4))))))
-
-;(my-get-window-type)
-
+ (cond ((and (not (window-in-direction 'right nil t -1))
+ (not (window-in-direction 'left nil t -1))
+ (not (window-in-direction 'below nil t 1)))
+ 1)
+ ((and (window-in-direction 'right nil t -1)
+ (not (window-in-direction 'left nil t -1))
+ (not (window-in-direction 'below nil t 1)))
+ 2)
+ ((and (not (window-in-direction 'right nil t -1))
+ (window-in-direction 'left nil t -1)
+ (not (window-in-direction 'below nil t 1)))
+ 3)
+ ((and (window-in-direction 'right nil t -1)
+ (not (window-in-direction 'left nil t -1))
+ (window-in-direction 'below nil t 1))
+ 5)
+ ((and (not (window-in-direction 'right nil t -1))
+ (window-in-direction 'left nil t -1)
+ (window-in-direction 'below nil t 1))
+ 6)
+ (t
+ 4)))
+(my-get-window-type)
(defun sd/powerline-center-theme_revised-2 ()
"Setup a mode-line with major and minor modes centered."
(interactive)
'("%e"
(:eval
(let* ((window-type (my-get-window-type))
- ;; (active (powerline-selected-window-active))
- (active t)
- ;; (mode-line-buffer-id (if active 'sd/mode-line-buffer-id 'mode-line-buffer-id-inactive))
- (mode-line-buffer-id (if active 'sd/mode-line-buffer-id 'powerline-inactive1))
- (mode-line (if active 'mode-line 'mode-line-inactive))
- (my-face1 (if active 'sd/powerline-active1 'powerline-inactive1))
- (my-face-buffer-modified (if (and (sd/buffer-is-eshel-or-scratch) (buffer-modified-p) (not buffer-read-only))
- 'sd/buffer-modified-active1
- (if buffer-read-only 'sd/buffer-view-active1
- my-face1)))
- (face1 (if active 'powerline-active1 'powerline-inactive1))
- (face2 (if active 'powerline-active2 'powerline-inactive2))
+ (active (powerline-selected-window-active))
+ ;; (active t)
+ ;; (my-face1 (if active 'sd/powerline-active1 'powerline-inactive1))
+ (my-face1 'sd/powerline-active1 )
+ ;; (my-face-buffer-modified (if (and (sd/buffer-is-eshel-or-scratch) (buffer-modified-p) (not buffer-read-only))
+ ;; 'sd/buffer-modified-active1
+ ;; (if buffer-read-only 'sd/buffer-view-active1
+ ;; my-face1)))
+ (face1 'powerline-active1)
+ (face2 'powerline-active2)
(separator-left (intern (format "powerline-%s-%s"
(powerline-current-separator)
(car powerline-default-separator-dir))))
(separator-right (intern (format "powerline-%s-%s"
(powerline-current-separator)
(cdr powerline-default-separator-dir))))
- (lhs (if (or (= window-type 1) (= window-type 2) (= window-type 3) (= window-type 5))
- (list (powerline-raw "%* " my-face-buffer-modified 'l)
- (powerline-raw " " my-face1)
- (funcall separator-left my-face1 face1)
- (powerline-narrow face1 'l)
- (sd/powerline-simpler-vc (powerline-vc face1)))
+ (lhs (if (or (= window-type 1) (= window-type 2) (= window-type 3) (= window-type 6))
+ (let ((lface))
+ (if (or (= window-type 1) (= window-type 2))
+ (setq lface my-face1)
+ (if active
+ (setq lface my-face1)
+ (setq lface face2)))
+ (list (powerline-raw "%* " lface 'l)
+ ;; (powerline-raw "%* " my-face-buffer-modified 'l)
+ (powerline-raw " " lface)
+ (funcall separator-left lface face1)
+ (powerline-narrow face1 'l)
+ ;; (sd/powerline-simpler-vc (powerline-vc face1))
+ ))
nil))
(center (if (or (= window-type 1) (= window-type 4))
- (list (powerline-raw " " face1)
- (funcall separator-right face1 face2)
- (powerline-raw (concat " ==" (number-to-string (my-get-window-type)) "== ") face2)
- (funcall separator-left face2 face1))
+ (let ((cface))
+ (if active
+ (setq cface my-face1)
+ (setq cface face2))
+ (list (powerline-raw " " face1)
+ (funcall separator-right face1 cface)
+ (powerline-raw (concat " ==" (number-to-string (my-get-window-type)) "== ") cface)
+ (funcall separator-left cface face1)))
nil))
- (rhs (if (or (= window-type 1) (= window-type 3) (= window-type 2) (= window-type 6))
- (list (powerline-raw (format-time-string " %I:%M %p ") my-face1 'r))
+ (rhs (if (or (= window-type 1) (= window-type 3) (= window-type 2) (= window-type 5))
+ (let ((rface))
+ (if (or (= window-type 1) (= window-type 3))
+ (setq rface my-face1)
+ (if active
+ (setq rface my-face1)
+ (setq rface face2)))
+ (list (funcall separator-right face1 rface)
+ (powerline-raw (format-time-string " %I:%M %p ") rface 'r)))
nil)))
(concat (powerline-render lhs)
(powerline-fill-center face1 (/ (powerline-width center) 2.0))