-
Notifications
You must be signed in to change notification settings - Fork 5
/
spaceline-extra-segments.el
65 lines (50 loc) · 2.46 KB
/
spaceline-extra-segments.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
;;; spaceline-extra-segments.el --- Additional segments for spaceline all the icons theme -*- lexical-binding: t -*-
;; Author: Steve Lane
;; Maintainer: Steve Lane
;; Version: 0.1
;; Package-Requires: (spaceline, all-the-icons)
;; Homepage: homepage
;; Keywords: keywords
;; This file is not part of GNU Emacs
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; These segments are inspired by both the spacemacs spaceline, and the
;; all-the-icons spaceline.
;;; Code:
(defvar sprazza/org-clock-format-function
'org-clock-get-clock-string
"The function called by the `org-clock' segment to determine what to show.")
(spaceline-define-segment sprazza/org-clock
"Show information about the current org clock task. Configure
`sprazza/org-clock-format-function' to configure. Requires a currently running
org clock.
This segment overrides the modeline functionality of `org-mode-line-string'."
(when (and (fboundp 'org-clocking-p)
(org-clocking-p))
;; Throw in here all-the-icons stuff
(let ((face `(:height ,(spaceline-all-the-icons--height 0.9) :inherit)))
(propertize
(concat
(propertize (all-the-icons-faicon "check-circle" :v-adjust 0.1)
'face `(:height ,(spaceline-all-the-icons--height 1.1) :family ,(all-the-icons-faicon-family) :inherit))
" "
(propertize (truncate-string-to-width (funcall spaceline-org-clock-format-function) 50 nil nil "…")
'face face
'display '(raise 0.1)))
'help-echo "Go to task"
'mouse-face (spaceline-all-the-icons--highlight)
'local-map (make-mode-line-mouse-map 'mouse-1 #'org-clock-goto)))
)
:global-override org-mode-line-string)
;; Then add it to the segments (this function expects to be called later in config)
(spaceline-all-the-icons-theme 'sprazza/org-clock)
;;; spaceline-extra-segments.el ends here