1
0
Fork 0

Add some icons to ‘org-agenda-category-icon-alist’

This commit is contained in:
Tom Willemse 2020-08-18 08:00:45 -07:00
parent 33cf3eb5ef
commit 8a56b6b1ce
11 changed files with 30 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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 hasnt 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)