diff --git a/oni-org/icons/icons8-bug-64.png b/oni-org/icons/icons8-bug-64.png new file mode 100644 index 0000000..f2da9b0 Binary files /dev/null and b/oni-org/icons/icons8-bug-64.png differ diff --git a/oni-org/icons/icons8-checkmark-64.png b/oni-org/icons/icons8-checkmark-64.png new file mode 100644 index 0000000..783a104 Binary files /dev/null and b/oni-org/icons/icons8-checkmark-64.png differ diff --git a/oni-org/icons/icons8-code-64.png b/oni-org/icons/icons8-code-64.png new file mode 100644 index 0000000..75c36ca Binary files /dev/null and b/oni-org/icons/icons8-code-64.png differ diff --git a/oni-org/icons/icons8-email-64.png b/oni-org/icons/icons8-email-64.png new file mode 100644 index 0000000..7941b8e Binary files /dev/null and b/oni-org/icons/icons8-email-64.png differ diff --git a/oni-org/icons/icons8-game-controller-64.png b/oni-org/icons/icons8-game-controller-64.png new file mode 100644 index 0000000..496ef80 Binary files /dev/null and b/oni-org/icons/icons8-game-controller-64.png differ diff --git a/oni-org/icons/icons8-inbox-64.png b/oni-org/icons/icons8-inbox-64.png new file mode 100644 index 0000000..303f154 Binary files /dev/null and b/oni-org/icons/icons8-inbox-64.png differ diff --git a/oni-org/icons/icons8-light-64.png b/oni-org/icons/icons8-light-64.png new file mode 100644 index 0000000..755c692 Binary files /dev/null and b/oni-org/icons/icons8-light-64.png differ diff --git a/oni-org/icons/icons8-shopping-cart-64.png b/oni-org/icons/icons8-shopping-cart-64.png new file mode 100644 index 0000000..1018718 Binary files /dev/null and b/oni-org/icons/icons8-shopping-cart-64.png differ diff --git a/oni-org/icons/icons8-sprout-64.png b/oni-org/icons/icons8-sprout-64.png new file mode 100644 index 0000000..03ecb67 Binary files /dev/null and b/oni-org/icons/icons8-sprout-64.png differ diff --git a/oni-org/icons/icons8-workstation-64.png b/oni-org/icons/icons8-workstation-64.png new file mode 100644 index 0000000..a542fb4 Binary files /dev/null and b/oni-org/icons/icons8-workstation-64.png differ diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index 2e7f378..21af167 100644 --- a/oni-org/oni-org.el +++ b/oni-org/oni-org.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.0812.204753 +;; Version: 2020.0818.080005 ;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org-plus-contrib org-bullets org-edna diminish all-the-icons) ;; This program is free software; you can redistribute it and/or modify @@ -22,7 +22,9 @@ ;;; Commentary: -;; Configuration for `org-mode'. +;; Configuration for `org-mode'. The icons used in +;; ‘org-agenda-category-icon-alist’ are from the Gradient Line style of Icons 8. +;; See URL ‘htps://icons8.com’. ;;; Code: @@ -50,6 +52,10 @@ (expand-file-name "snippets" oni-org-root) "The directory where ‘oni-org’ stores its snippets.") +(defconst oni-org-icons-dir + (expand-file-name "icons" oni-org-root) + "The directory where ‘oni-org’ stores its icons.") + (defun oni-org-expand-to-home (file-name) "Expand FILE-NAME to the base directory for that system. The base for all org files on Windows is u:/, but on my linux @@ -167,6 +173,27 @@ After running it once remove it from `org-capture-after-finalize-hook'." (setq org-tag-faces (oni-org-generate-tag-faces)) (org-set-tag-faces 'org-tag-faces org-tag-faces)) +(defun oni-org-set-agenda-category-icons () + "Set ‘org-agenda-category-icon-alist’." + (let* ((icon-height (window-default-font-height)) + (defaults `(png nil :height ,icon-height :ascent center))) + (setq org-agenda-category-icon-alist + `((,(rx string-start "task" string-end) ,(expand-file-name "icons8-checkmark-64.png" oni-org-icons-dir) ,@defaults) + (,(rx string-start "inbox" string-end) ,(expand-file-name "icons8-inbox-64.png" oni-org-icons-dir) ,@defaults) + (,(rx string-start "email" string-end) ,(expand-file-name "icons8-email-64.png" oni-org-icons-dir) ,@defaults) + (,(rx string-start "life" string-end) ,(expand-file-name "icons8-sprout-64.png" oni-org-icons-dir) ,@defaults) + (,(rx string-start "feature" string-end) ,(expand-file-name "icons8-code-64.png" oni-org-icons-dir) ,@defaults) + (,(rx string-start "work" string-end) ,(expand-file-name "icons8-workstation-64.png" oni-org-icons-dir) ,@defaults) + (,(rx string-start "game" string-end) ,(expand-file-name "icons8-game-controller-64.png" oni-org-icons-dir) ,@defaults) + (,(rx string-start "shopping" string-end) ,(expand-file-name "icons8-shopping-cart-64.png" oni-org-icons-dir) ,@defaults) + (,(rx string-start "bug" string-end) ,(expand-file-name "icons8-bug-64.png" oni-org-icons-dir) ,@defaults) + (,(rx string-start "idea" string-end) ,(expand-file-name "icons8-light-64.png" oni-org-icons-dir) ,@defaults))))) + +(defun oni-org-initialize-agenda-category-icons () + "Set ‘org-agenda-category-icon-alist’ if it hasn’t already been set." + (when (null org-agenda-category-icon-alist) + (oni-org-set-agenda-category-icons))) + ;;;###autoload(autoload 'oni-hydra-org/body "oni-org") (defhydra oni-hydra-org (:color teal :hint nil) " @@ -331,6 +358,7 @@ also move point to the start of the heading." (add-to-list 'org-babel-load-languages '(java . t)) +(add-hook 'org-mode-hook #'oni-org-initialize-agenda-category-icons) (add-hook 'org-mode-hook #'oni-org-set-tag-faces) (add-hook 'org-mode-hook #'oni-org-set-todo-keyword-faces) (add-hook 'org-mode-hook 'flyspell-mode)