2017-04-12 03:09:27 +00:00
|
|
|
;;; packages.el --- Spacemacs Mode-line Visual Layer packages File
|
|
|
|
;;
|
|
|
|
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
|
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
(setq spacemacs-modeline-packages
|
|
|
|
'(
|
|
|
|
fancy-battery
|
|
|
|
spaceline
|
2017-04-12 03:36:13 +00:00
|
|
|
symon
|
2017-04-12 03:09:27 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
(defun spacemacs-modeline/init-fancy-battery ()
|
|
|
|
(use-package fancy-battery
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs|add-toggle mode-line-battery
|
|
|
|
:mode fancy-battery-mode
|
|
|
|
:documentation "Display battery info in mode-line."
|
|
|
|
:evil-leader "tmb")
|
|
|
|
(setq-default fancy-battery-show-percentage t))))
|
|
|
|
|
|
|
|
(defun spacemacs-modeline/init-spaceline ()
|
|
|
|
(use-package spaceline-config
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(add-hook 'spacemacs-post-user-config-hook 'spaceline-compile)
|
|
|
|
(add-hook 'spacemacs-post-theme-change-hook
|
|
|
|
'spacemacs/customize-powerline-faces)
|
|
|
|
(add-hook 'spacemacs-post-theme-change-hook 'powerline-reset)
|
|
|
|
(setq-default powerline-default-separator 'utf-8)
|
|
|
|
(spacemacs|do-after-display-system-init
|
|
|
|
(when (and (eq 'utf-8 powerline-default-separator))
|
|
|
|
(setq-default powerline-default-separator 'wave))
|
|
|
|
;; seems to be needed to avoid weird graphical artefacts with the
|
|
|
|
;; first graphical client
|
|
|
|
(require 'spaceline)
|
|
|
|
(spaceline-compile)))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs/customize-powerline-faces)
|
|
|
|
(setq spaceline-org-clock-p nil
|
|
|
|
spaceline-highlight-face-func 'spacemacs//evil-state-face)
|
|
|
|
;; Segment toggles
|
|
|
|
(dolist (spec '((minor-modes "tmm")
|
|
|
|
(major-mode "tmM")
|
|
|
|
(version-control "tmv")
|
|
|
|
(new-version "tmV")
|
|
|
|
(point-position "tmp")
|
|
|
|
(org-clock "tmc")))
|
|
|
|
(let* ((segment (car spec))
|
|
|
|
(status-var (intern (format "spaceline-%S-p" segment))))
|
|
|
|
(eval `(spacemacs|add-toggle ,(intern (format "mode-line-%S" segment))
|
|
|
|
:status ,status-var
|
|
|
|
:on (setq ,status-var t)
|
|
|
|
:off (setq ,status-var nil)
|
|
|
|
:documentation ,(format "Show %s in the mode-line."
|
|
|
|
(replace-regexp-in-string
|
|
|
|
"-" " " (format "%S" segment)))
|
|
|
|
:evil-leader ,(cadr spec)))))
|
|
|
|
;; unicode
|
|
|
|
(let ((unicodep (dotspacemacs|symbol-value
|
|
|
|
dotspacemacs-mode-line-unicode-symbols)))
|
|
|
|
(setq spaceline-window-numbers-unicode unicodep
|
|
|
|
spaceline-workspace-numbers-unicode unicodep))
|
|
|
|
(add-hook 'spaceline-pre-hook 'spacemacs//prepare-diminish)
|
|
|
|
;; New spacemacs version segment
|
|
|
|
(defpowerline spacemacs-powerline-new-version
|
|
|
|
(propertize
|
|
|
|
spacemacs-version-check-lighter
|
|
|
|
'mouse-face 'mode-line-highlight
|
|
|
|
'help-echo (format "New version %s | Click with mouse-1 to update"
|
|
|
|
spacemacs-new-version)
|
|
|
|
'local-map (let ((map (make-sparse-keymap)))
|
|
|
|
(define-key map
|
|
|
|
[mode-line down-mouse-1]
|
|
|
|
(lambda (event)
|
|
|
|
(interactive "@e")
|
|
|
|
(if (yes-or-no-p
|
|
|
|
(format
|
|
|
|
(concat "Do you want to update to the newest "
|
|
|
|
"version %s ?") spacemacs-new-version))
|
|
|
|
(progn
|
|
|
|
(spacemacs/switch-to-version
|
|
|
|
spacemacs-new-version))
|
|
|
|
(message "Update aborted."))))
|
|
|
|
map)))
|
|
|
|
(spaceline-define-segment new-version
|
|
|
|
(when spacemacs-new-version
|
|
|
|
(spacemacs-powerline-new-version
|
|
|
|
(spacemacs/get-new-version-lighter-face
|
|
|
|
spacemacs-version spacemacs-new-version))))
|
|
|
|
(apply #'spaceline-spacemacs-theme
|
|
|
|
spacemacs-spaceline-additional-segments)
|
|
|
|
;; Additional spacelines
|
|
|
|
(when (package-installed-p 'helm)
|
|
|
|
(spaceline-helm-mode t))
|
2017-07-02 13:48:06 +00:00
|
|
|
(when (configuration-layer/package-used-p 'info+)
|
2017-04-12 03:09:27 +00:00
|
|
|
(spaceline-info-mode t))
|
|
|
|
;; Enable spaceline for buffers created before the configuration of
|
|
|
|
;; spaceline
|
|
|
|
(spacemacs//set-powerline-for-startup-buffers))))
|
2017-04-12 03:36:13 +00:00
|
|
|
|
|
|
|
(defun spacemacs-modeline/init-symon ()
|
|
|
|
(use-package symon
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq symon-delay 0
|
|
|
|
symon-refresh-rate 2)
|
|
|
|
(spacemacs|add-toggle minibuffer-system-monitor
|
|
|
|
:mode symon-mode
|
|
|
|
:evil-leader "tms"))))
|