diff options
| author | BardofSprites <[email protected]> | 2026-01-06 22:15:52 -0500 |
|---|---|---|
| committer | BardofSprites <[email protected]> | 2026-01-06 22:15:52 -0500 |
| commit | 571190b98fe909bfe6844db4a8833cb079860290 (patch) | |
| tree | 12ee35fcf63a9a39e06688324e77df0860d38370 | |
| parent | a0e271005f450aca49af45fa7f5f7fc8193676ba (diff) | |
org clock modeline indicator
| -rw-r--r-- | bard-elisp/bard-modeline.el | 47 | ||||
| -rw-r--r-- | bard-elisp/bard-theme.el | 7 | ||||
| -rw-r--r-- | bard-elisp/bard-writing.el | 2 | ||||
| -rw-r--r-- | bard-emacs-modules/bard-emacs-modeline.el | 1 | ||||
| -rw-r--r-- | bard-emacs-modules/bard-emacs-org.el | 2 | ||||
| -rw-r--r-- | config.org | 146 |
6 files changed, 153 insertions, 52 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))) diff --git a/bard-emacs-modules/bard-emacs-modeline.el b/bard-emacs-modules/bard-emacs-modeline.el index 2b10722..34074f7 100644 --- a/bard-emacs-modules/bard-emacs-modeline.el +++ b/bard-emacs-modules/bard-emacs-modeline.el @@ -22,6 +22,7 @@ " " prot-modeline-flymake prot-modeline-eglot + bard-modeline-org-clock " " mode-line-format-right-align prot-modeline-notmuch-indicator diff --git a/bard-emacs-modules/bard-emacs-org.el b/bard-emacs-modules/bard-emacs-org.el index 0d7c1ed..976e106 100644 --- a/bard-emacs-modules/bard-emacs-org.el +++ b/bard-emacs-modules/bard-emacs-org.el @@ -166,7 +166,7 @@ "* [[%:link][%:description]] \nCaptured On: %U \n%?") ("w" "Class outline" entry (file - "~/Notes/denote/20240328T215727--todo.org") + "~/Notes/denote/uni.org") (file "~/Notes/denote/templates/class-template.org")) ("p" "project idea" entry @@ -1207,55 +1207,56 @@ For a long time I really struggled with Emacs tab completion. It still only kind ** bard-emacs-modeline #+begin_src emacs-lisp :tangle bard-emacs-modules/bard-emacs-modeline.el :mkdirp yes -(require 'bard-modeline) - -;;; Mode line -(setq mode-line-compact nil) ; Emacs 28 -(setq mode-line-right-align-edge 'right-margin) -(setq-default mode-line-format - '("%e" - prot-modeline-kbd-macro - prot-modeline-narrow - bard-modeline-centered-cursor - prot-modeline-input-method - prot-modeline-buffer-status - prot-modeline-window-dedicated-status - bard-evil-state-indicator - " " - prot-modeline-buffer-identification - " " - prot-modeline-major-mode - prot-modeline-process - " " - prot-modeline-vc-branch - " " - prot-modeline-flymake - prot-modeline-eglot - " " - mode-line-format-right-align - prot-modeline-notmuch-indicator - " " - prot-modeline-misc-info - " ")) - -(with-eval-after-load 'spacious-padding - (defun prot/modeline-spacious-indicators () - "Set box attribute to `'prot-modeline-indicator-button' if spacious-padding is enabled." - (if (bound-and-true-p spacious-padding-mode) - (set-face-attribute 'prot-modeline-indicator-button nil :box t) - (set-face-attribute 'prot-modeline-indicator-button nil :box 'unspecified))) - - ;; Run it at startup and then afterwards whenever - ;; `spacious-padding-mode' is toggled on/off. - (prot/modeline-spacious-indicators) - - (add-hook 'spacious-padding-mode-hook #'prot/modeline-spacious-indicators)) - -(setq mode-line-right-align-edge 'window) - -(provide 'bard-emacs-modeline) - -;;; bard-emacs-modeline.el ends here + (require 'bard-modeline) + + ;;; Mode line + (setq mode-line-compact nil) ; Emacs 28 + (setq mode-line-right-align-edge 'right-margin) + (setq-default mode-line-format + '("%e" + prot-modeline-kbd-macro + prot-modeline-narrow + bard-modeline-centered-cursor + prot-modeline-input-method + prot-modeline-buffer-status + prot-modeline-window-dedicated-status + bard-evil-state-indicator + " " + prot-modeline-buffer-identification + " " + prot-modeline-major-mode + prot-modeline-process + " " + prot-modeline-vc-branch + " " + prot-modeline-flymake + prot-modeline-eglot + bard-modeline-org-clock + " " + mode-line-format-right-align + prot-modeline-notmuch-indicator + " " + prot-modeline-misc-info + " ")) + + (with-eval-after-load 'spacious-padding + (defun prot/modeline-spacious-indicators () + "Set box attribute to `'prot-modeline-indicator-button' if spacious-padding is enabled." + (if (bound-and-true-p spacious-padding-mode) + (set-face-attribute 'prot-modeline-indicator-button nil :box t) + (set-face-attribute 'prot-modeline-indicator-button nil :box 'unspecified))) + + ;; Run it at startup and then afterwards whenever + ;; `spacious-padding-mode' is toggled on/off. + (prot/modeline-spacious-indicators) + + (add-hook 'spacious-padding-mode-hook #'prot/modeline-spacious-indicators)) + + (setq mode-line-right-align-edge 'window) + + (provide 'bard-emacs-modeline) + + ;;; bard-emacs-modeline.el ends here #+end_src @@ -3600,8 +3601,54 @@ This is another one of prot's libraries that I copied and modified a long time a 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) @@ -3618,6 +3665,7 @@ This is another one of prot's libraries that I copied and modified a long time a 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 |
