X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=emacs.d%2Felisp%2Fmy-mode-line.el;fp=emacs.d%2Felisp%2Fmy-mode-line.el;h=c03503d769173072685bbe951cad04d952f0d5a1;hb=0b557f806529e3a8d870d0d3363fb881ccb99539;hp=5843635028f30934560a39750c1fd09291522a65;hpb=638594fecdc9353ba07ebe74320c0a619580cbd1;p=dotfiles.git diff --git a/emacs.d/elisp/my-mode-line.el b/emacs.d/elisp/my-mode-line.el index 5843635..c03503d 100644 --- a/emacs.d/elisp/my-mode-line.el +++ b/emacs.d/elisp/my-mode-line.el @@ -68,20 +68,51 @@ window type." "My Powerline face 1 based on powerline-active1." :group 'powerline) +(defface my-powerline-ws-bg '((t (:background "blue" :foreground "black" :inherit mode-line))) + "My Powerline face 1 based on powerline-active1." + :group 'powerline) + (defun my-get-ws-name-list () "Return the name list of workspaces gotten from `perspeen-modestring' without the properties." (split-string (substring-no-properties (cadr perspeen-modestring)) "|")) +(defun my-get-selected-ws-name () + (let ((ret)) + (dolist (i (split-string (cadr perspeen-modestring) "|") ret) + (if (equal (car (text-properties-at 1 i)) + 'face) + (setq ret (substring-no-properties i)))))) + (defun my-build-left-below-mode-line (separator lface face1) - (let ((l)) - (setq l (list (powerline-raw " workspace " lface))) - (mapc (lambda (i) - (setq l (append l (list (powerline-raw i lface)))) - (setq l (append l (list (funcall separator lface face1))))) - (my-get-ws-name-list)) + (let ((l) + (ff1) + (ff2) + (selected-name (my-get-selected-ws-name)) + (name-list (my-get-ws-name-list))) + (if (string= selected-name (car name-list)) + (progn + (setq l (list (powerline-raw " workspace " lface) + (funcall separator lface 'my-powerline-hl-ws) + (powerline-raw (car name-list) 'my-powerline-hl-ws) + (funcall separator 'my-powerline-hl-ws face1))) + (dolist (i (cdr name-list)) + (setq l (append l (list (powerline-raw i face1) + (funcall separator face1 face1)))))) + (setq l (list (powerline-raw " workspace " lface) + (funcall separator lface face1))) + (while name-list + (let ((current-selected (string= selected-name (car name-list))) + (next-selected (string= selected-name (cadr name-list)))) + (setq l (append l (list (powerline-raw (car name-list) (if current-selected + 'my-powerline-hl-ws + face1)) + (funcall separator (if current-selected 'my-powerline-hl-ws face1) + (if next-selected + 'my-powerline-hl-ws + face1)))))) + (pop name-list))) l)) - (defun sd/powerline-center-theme_revised-2 () "Setup a mode-line with major and minor modes centered." (interactive)