2019-07-21 00:37:46 +02:00
|
|
|
;;; modeline.el --- Module file for configuring the modeline.
|
|
|
|
;;
|
|
|
|
;; Copyright (C) 2018-2019 Wojciech Kozlowski
|
|
|
|
;;
|
|
|
|
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
|
|
|
;; Created: 2018-02-11
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; Commentary:
|
|
|
|
;;
|
|
|
|
;; This module is used for configuring the modeline.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
;;; Required packages:
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(defvar emodule/modeline-packages
|
|
|
|
|
|
|
|
'(anzu
|
|
|
|
doom-modeline)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
;;; Configuration:
|
|
|
|
|
|
|
|
(defun emodule/modeline-init ()
|
|
|
|
"Initialise the `modeline' module."
|
|
|
|
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
;; `anzu'
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(use-package anzu
|
|
|
|
:config
|
|
|
|
(global-anzu-mode 1))
|
|
|
|
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
;; `doom-modeline' - note that doom-modeline requires all-the-icons which in
|
|
|
|
;; turn require the user to manually install the fonts with the command `M-x
|
|
|
|
;; all-the-icons-install-fonts'.
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(use-package doom-modeline
|
|
|
|
:hook
|
|
|
|
(after-init . doom-modeline-mode)
|
|
|
|
:config
|
|
|
|
(setq column-number-mode t
|
|
|
|
doom-modeline-height 23
|
|
|
|
doom-modeline-checker-simple-format nil
|
|
|
|
doom-modeline-env-python-executable "python3")
|
|
|
|
|
|
|
|
;; Custom perspective display - display only the active perspective.
|
|
|
|
(doom-modeline-def-segment perspective-name
|
|
|
|
"Perspectives list and selection. Requires `persp-mode' to be enabled."
|
|
|
|
(if (bound-and-true-p persp-mode)
|
|
|
|
(persp-format-name (persp-name (persp-curr)))
|
|
|
|
""))
|
|
|
|
|
2019-08-07 11:55:30 +02:00
|
|
|
;; Display active python virtualenv.
|
|
|
|
(defface pyvenv-active-face
|
|
|
|
'((t (:inherit persp-selected-face)))
|
|
|
|
"The face used to highlight the active virtualenv on the modeline.")
|
|
|
|
|
|
|
|
(doom-modeline-def-segment pyvenv-venv
|
|
|
|
"Active Python virtualenv. Requires `pyvenv' to be enabled."
|
|
|
|
(if (bound-and-true-p pyvenv-virtual-env-name)
|
|
|
|
(propertize pyvenv-virtual-env-name 'face 'pyvenv-active-face)
|
|
|
|
""))
|
|
|
|
|
2019-12-15 16:36:30 +01:00
|
|
|
(doom-modeline-def-segment workspace-number
|
|
|
|
"The current workspace name or number.
|
|
|
|
|
|
|
|
Requires `eyebrowse-mode' to be enabled."
|
|
|
|
|
|
|
|
(if (bound-and-true-p eyebrowse-mode)
|
|
|
|
(let* ((num (eyebrowse--get 'current-slot))
|
|
|
|
(tag (when num (nth 2 (assoc num (eyebrowse--get 'window-configs)))))
|
|
|
|
(str (if (and tag (< 0 (length tag)))
|
|
|
|
tag
|
|
|
|
(when num (int-to-string num)))))
|
|
|
|
(propertize str 'face 'eyebrowse-mode-line-active))
|
|
|
|
""))
|
|
|
|
|
2019-07-21 00:37:46 +02:00
|
|
|
;; Necessary to play nice with Helm.
|
|
|
|
(add-hook 'helm-minibuffer-set-up-hook
|
|
|
|
(lambda ()
|
|
|
|
(advice-add #'doom-modeline--active :override (lambda () t))))
|
|
|
|
(add-hook 'helm-cleanup-hook
|
|
|
|
(lambda ()
|
|
|
|
(advice-remove #'doom-modeline--active (lambda () t))))
|
|
|
|
|
|
|
|
;; Define custom modeline.
|
|
|
|
(doom-modeline-def-modeline 'my-line
|
2019-12-15 16:36:30 +01:00
|
|
|
'(bar "[" perspective-name ":" workspace-number "]" window-number matches buffer-info remote-host buffer-position selection-info)
|
2019-08-07 11:55:30 +02:00
|
|
|
'(lsp debug pyvenv-venv major-mode vcs checker bar))
|
2019-07-21 00:37:46 +02:00
|
|
|
|
|
|
|
(add-hook 'doom-modeline-mode-hook
|
|
|
|
(lambda () (doom-modeline-set-modeline 'my-line 'default))))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
(provide 'emodule/modeline)
|
|
|
|
;;; modeline.el ends here
|