From 0223d899c456049d42e1ff0ba1bc1818a26b6696 Mon Sep 17 00:00:00 2001 From: Daniel <89086143+BardofSprites@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:31:18 -0400 Subject: nu dashboard --- bard-elisp/bard-dashboard.el | 54 ++++++++++++++++++++++++++++++ bard-emacs-modules/bard-emacs-dashboard.el | 32 ++++++++++++++++++ bard-emacs-modules/bard-emacs-package.el | 18 +--------- bard-emacs-modules/bard-emacs-web.el | 1 + 4 files changed, 88 insertions(+), 17 deletions(-) create mode 100644 bard-elisp/bard-dashboard.el create mode 100644 bard-emacs-modules/bard-emacs-dashboard.el diff --git a/bard-elisp/bard-dashboard.el b/bard-elisp/bard-dashboard.el new file mode 100644 index 0000000..95e8da5 --- /dev/null +++ b/bard-elisp/bard-dashboard.el @@ -0,0 +1,54 @@ + (defun dashboard-insert-custom (list-size) + "Insert custom itemes LIST-SIZE." + (interactive) + (insert "  TODOs (A)  Cal: (c)  Mail: (m)  Emacs: (e)")) + +(add-hook 'dashboard-mode-hook + (lambda() + (define-key dashboard-mode-map (kbd "A") #'(lambda ()(interactive)(org-agenda nil "D"))) + ;; FIXME look at browse url for explanation + ;; (define-key global-map (kbd "g") #') + (define-key dashboard-mode-map (kbd "c") #'calendar) + (define-key dashboard-mode-map (kbd "m") #'notmuch) + (define-key dashboard-mode-map (kbd "e") #'(lambda ()(interactive)(dired user-emacs-directory))) + )) + +(defvar dashboard-recover-layout-p nil + "Whether recovers the layout.") + +(defun open-dashboard () + "Open the *dashboard* buffer and jump to the first widget." + (interactive) + (setq dashboard-recover-layout-p t) + (delete-other-windows) + (dashboard-refresh-buffer) + (dashboard-goto-recent-files)) + +(defun quit-dashboard () + "Quit dashboard window." + (interactive) + (quit-window t) + (when (and dashboard-recover-layout-p + (bound-and-true-p winner-mode)) + (winner-undo) + (setq dashboard-recover-layout-p nil))) + +;; TODO replace with browse-url librewolf that opens to localhost new tab +;; (defun bard/open-librewolf () +;; (interactive) +;; (if (string-match "\\`bardiel" system-name) +;; (async-shell-command "librewolf-bin")) +;; '(async-shell-command "librewolf")) + +;; TODO replace this with browse-url that opens to localhost new tab +;; (defun bard/open-firefox () +;; (interactive) +;; (if (string-match "\\`bardiel" system-name) +;; (async-shell-command "firefox-bin")) +;; '(async-shell-command "firefox")) + +;; FIXME browse-url-librewolf is incomplete +;; (defun bard/open-user-github () +;; (browse-url-librewolf 'user-github-url)) + +(provide 'bard-dashboard) diff --git a/bard-emacs-modules/bard-emacs-dashboard.el b/bard-emacs-modules/bard-emacs-dashboard.el new file mode 100644 index 0000000..87f9044 --- /dev/null +++ b/bard-emacs-modules/bard-emacs-dashboard.el @@ -0,0 +1,32 @@ +(require 'bard-dashboard) + +(use-package dashboard + :ensure t + :config + (define-key global-map (kbd "") #'dashboard-open) + (define-key global-map (kbd "C-z d") #'dashboard-open) + (setq initial-buffer-choice 'dashboard-open) + (dashboard-setup-startup-hook) + (setq dashboard-startup-banner "~/.emacs.d/img/emacslogo.png") + (setq dashboard-banner-logo-width 50) + (setq dashboard-banner-logo-height 50) + (setq dashboard-center-content t) + ;; dashboar items + (setq dashboard-items '((recents . 5) + (agenda . 5))) + + ;; Insert custom item + (add-to-list 'dashboard-item-generators '(custom . dashboard-insert-custom)) + (add-to-list 'dashboard-items '(custom) t) + + (setq dashboard-banner-logo-title "Time for another recreational programming session.") + (setq dashboard-startupify-list '(dashboard-insert-banner + dashboard-insert-newline + dashboard-insert-banner-title + dashboard-insert-newline + dashboard-insert-items + dashboard-insert-newline)) + + (setq dashboard-set-init-info nil)) + +(provide 'bard-emacs-dashboard) diff --git a/bard-emacs-modules/bard-emacs-package.el b/bard-emacs-modules/bard-emacs-package.el index 276e30a..bc856ae 100644 --- a/bard-emacs-modules/bard-emacs-package.el +++ b/bard-emacs-modules/bard-emacs-package.el @@ -58,8 +58,7 @@ (global-set-key (kbd "C-x b") #'consult-buffer) (global-set-key (kbd "C-c s") #'consult-line) (global-set-key (kbd "C-c C-s") nil) - (global-set-key (kbd "C-z s") #'consult-ripgrep) - (global-set-key (kbd "M-s M-o") #'consult-outline)) + (global-set-key (kbd "C-z s") #'consult-ripgrep)) (use-package yasnippet :init @@ -99,21 +98,6 @@ (completion-styles '(orderless basic)) (completion-category-overrides '((file (styles basic partial-completion))))) -(use-package dashboard - :ensure t - :config - (setq initial-buffer-choice 'dashboard-open) - (dashboard-setup-startup-hook) - (setq dashboard-startup-banner "~/.emacs.d/img/emacslogo.png") - (setq dashboard-banner-logo-width 50) - (setq dashboard-banner-logo-height 50) - (setq dashboard-center-content t) - (setq dashboard-items '((recents . 5) - (agenda . 5))) - (setq dashboard-banner-logo-title "Time for another recreational programming session") - (setq dashboard-set-footer nil) - (setq dashboard-set-init-info nil)) - (use-package elfeed :ensure t :config diff --git a/bard-emacs-modules/bard-emacs-web.el b/bard-emacs-modules/bard-emacs-web.el index 5547081..3af9c43 100644 --- a/bard-emacs-modules/bard-emacs-web.el +++ b/bard-emacs-modules/bard-emacs-web.el @@ -20,6 +20,7 @@ ;; librewolf open browser +;; TODO fix this to work with librewolf-bin on Gentoo (defun browse-url-librewolf (url &optional new-window) "Ask the Librewolf WWW browser to load URL. Defaults to the URL around or before point. Passes the strings -- cgit v1.2.3