aboutsummaryrefslogtreecommitdiff
path: root/bard-elisp
diff options
context:
space:
mode:
Diffstat (limited to 'bard-elisp')
-rw-r--r--bard-elisp/bard-modeline.el47
-rw-r--r--bard-elisp/bard-theme.el7
-rw-r--r--bard-elisp/bard-writing.el2
3 files changed, 54 insertions, 2 deletions
diff --git a/bard-elisp/bard-modeline.el b/bard-elisp/bard-modeline.el
index 39b710f..7a53c11 100644
--- a/bard-elisp/bard-modeline.el
+++ b/bard-elisp/bard-modeline.el
@@ -538,8 +538,54 @@ Display the indicator only on the focused window's mode line.")
state-label)))
"Modeline indicator for current Evil state.")
+
+;;;; Org clock indicator
+(defun bard-modeline--org-clock-check-overrun ()
+ "Check if the clock is overrun."
+ (when org-clock-effort
+ (> (org-clock-get-clocked-time)
+ (org-duration-to-minutes org-clock-effort))))
+
+(defun bard-modeline--org-clock-string ()
+ "Make a string for org-clock indicator."
+ (let* ((clocked-mins (org-clock-get-clocked-time))
+ (work-time (org-duration-from-minutes clocked-mins)))
+ (if org-clock-effort
+ (format "[%s/%s]"
+ work-time
+ org-clock-effort)
+ (format "[%s]" work-time))))
+
+(defun bard-modeline--org-clock-choose-face ()
+ "Make the background red when overrunning the clock."
+ (if (bard-modeline--org-clock-check-overrun)
+ 'prot-modeline-indicator-red-bg
+ 'prot-modeline-indicator-green-bg))
+
+(defvar-local bard-modeline-org-clock
+ '(:eval
+ (when (and (featurep 'org)
+ (bound-and-true-p org-clock-current-task)
+ (mode-line-window-selected-p))
+ (propertize
+ (concat " ⊙ "
+ (prot-modeline-string-truncate
+ (bard-modeline--org-clock-string))
+ " ")
+ 'face (bard-modeline--org-clock-choose-face)
+ 'mouse-face 'mode-line-highlight
+ 'help-echo "Org clocked task\nmouse-1: Go to task"
+ 'local-map (let ((map (make-sparse-keymap)))
+ (define-key map [mode-line down-mouse-1]
+ #'org-clock-goto)
+ map))))
+ "Mode line construct showing the current Org clocked task.")
+
;;;; Miscellaneous
+(setq global-mode-string
+ (remove 'org-mode-line-string global-mode-string))
+
(defvar-local prot-modeline-misc-info
'(:eval
(when (mode-line-window-selected-p)
@@ -556,6 +602,7 @@ Specific to the current window's mode line.")
bard-modeline-centered-cursor
bard-evil-state-indicator
prot-modeline-input-method
+ bard-modeline-org-clock
prot-modeline-buffer-status
prot-modeline-window-dedicated-status
prot-modeline-evil
diff --git a/bard-elisp/bard-theme.el b/bard-elisp/bard-theme.el
index 26e57fa..f006a18 100644
--- a/bard-elisp/bard-theme.el
+++ b/bard-elisp/bard-theme.el
@@ -21,7 +21,7 @@
:default-height 130
:default-weight medium
:fixed-pitch-family "Iosevka Comfy Wide Motion"
- :variable-pitch-family "Iosevka Comfy Wide Duo"
+ :variable-pitch-family "Iosevka Comfy Wide Motion Duo"
:bold-weight extrabold)
(mono
:default-height 130
@@ -38,6 +38,11 @@
:default-family "Monaco"
:variable-pitch-family "Monaco"
:fixed-pitch-family "Monaco")
+ (bit
+ :default-height 140
+ :default-family "Ttyp0 OTB"
+ :variable-pitch-family "Ttyp0 OTB"
+ :fixed-pitch-family "Ttyp0 OTB")
(large
:inherit default
:default-height 160)
diff --git a/bard-elisp/bard-writing.el b/bard-elisp/bard-writing.el
index 2ab9c0a..5437b33 100644
--- a/bard-elisp/bard-writing.el
+++ b/bard-elisp/bard-writing.el
@@ -98,7 +98,7 @@
"Return string for daily tasks heading in `denote-journal' entries."
(with-temp-buffer
(org-mode)
- (insert (format "* Tasks for %s\n** Время я потратил бездельничая\n\n* Notes for today\n\n"
+ (insert (format "* Tasks for %s\n** Время я потратил бездельничая\n\n* Notes for today\n\n* Clocktable\n"
(format-time-string "%Y-%m-%d (%a)")))
(let ((org-clock-clocktable-default-properties
'(:scope file :maxlevel 3 :link nil :compact t)))