;;; oni-dashboard.el --- Customization for the dashboard module -*- lexical-binding: t; -*- ;; Copyright (C) 2023 Tom Willemse ;; Author: Tom Willemse ;; Keywords: local ;; 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 . ;;; Commentary: ;; ;;; Code: (defun oni-dashboard-insert-random-note (_) "Insert a link to a random note from my Roam database." (dashboard-insert-heading "Today's Note:" "n") (insert "\n ") (dashboard-insert-shortcut 'random-note "n" "Today's Note:") (let ((element (seq-random-elt (org-roam-node-read--completions)))) (widget-create 'link :notify (lambda (&rest _) (find-file (org-roam-node-file (cdr element))) (goto-char (org-roam-node-point (cdr element)))) :button-prefix "" :button-suffix "" (string-trim-right (car element))))) (require 'org-roam) (add-to-list 'dashboard-item-generators '(random-note . oni-dashboard-insert-random-note)) (add-to-list 'dashboard-items '(random-note)) (provide 'oni-dashboard) ;;; oni-dashboard.el ends here