|
|
#+TITLE: Dotfiles #+AUTHOR: Christopher James Hayward #+EMAIL: chris@chrishayward.xyz
#+PROPERTY: header-args:emacs-lisp :comments org #+PROPERTY: header-args:shell :tangle no #+PROPERTY: header-args :results silent :eval no-export
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
#+ATTR_ORG: :width 420px #+ATTR_HTML: :width 420px #+ATTR_LATEX: :width 420px [[./docs/images/desktop-alt.png]]
Immutable GNU Emacs dotfiles. Built for Life, Liberty, and the Open Road.
+ 100% Literate + 100% Immutable + 100% Reproducible * Init :PROPERTIES: :header-args: :tangle init.el :END:
Here's a complete list of all of the options configurable for each host, and their default values. All variables prefixed with ~dotfiles/~. If you need to make configurations to another variable, consider creating a new option.
#+begin_src emacs-lisp (defvar dotfiles/font "Fira Code" "Unified system font family.")
(defvar dotfiles/font-size 96 "Unified system font size.")
(defvar dotfiles/browser (getenv "BROWSER") "Default system web browser.")
(defvar dotfiles/language (getenv "LANG") "Default system dictionary language.")
(defconst dotfiles/modules-p '(core editor email desktop writing projects interface) "All of the available modules.")
(defvar dotfiles/modules dotfiles/modules-p "All of the enabled modules.")
(defvar dotfiles/home user-emacs-directory "Original value of `user-emacs-directory'.")
(defvar dotfiles/cache (expand-file-name "~/.cache/emacs") "Redirection target of `user-emacs-directory'.")
(defvar dotfiles/idle 0.0 "Delay time before offering suggestions and completions.")
(defvar dotfiles/leader-key "SPC" "All powerful leader key.")
(defvar dotfiles/leader-key-global (concat "C-" dotfiles/leader-key) "Global prefix for the leader key.")
(defvar dotfiles/projects (expand-file-name "~/.local/source/") "Location of source code projects.")
(defvar dotfiles/passwords (expand-file-name "~/.password-store/") "Location of local password store.")
(defvar dotfiles/public-key "37AB1CB72B741E478CA026D43025DCBD46F81C0F" "GPG key to encrypt org files for.") #+end_src
* Hosts
Override any of the available options configurations in a host file. Here's some examples to get started:
+ [[file:hosts/localhost.org][Termux]] + [[file:hosts/raspberry.org][Raspberry]] + [[file:hosts/acernitro.org][Acernitro]] + [[file:hosts/virtualbox.org][Virtualbox]]
Begin the process by loading any host specific overrides. The host configuration tangles, and loads (if it exist) using the systems name.
#+begin_src emacs-lisp (let ((host-file (concat dotfiles/home "/hosts/" system-name ".org"))) (when (file-exists-p host-file) (org-babel-load-file host-file))) #+end_src
* Modules
Breaking down the project into logical units or chapters to keep the code more maintainable and organized. This is also a fundamental requirement to achieve the goal of modularity. Here are all of the available modules, also listed in the variable ~dotfiles/modules-p~.
+ [[file:modules/core.org][Core]] + [[file:modules/editor.org][Editor]] + [[file:modules/email.org][Email]] + [[file:modules/desktop.org][Desktop]]
By default all of the modules will load, override the variable ~dotfiles/modules~ in a host configuration to override this.
#+begin_src emacs-lisp (dolist (m dotfiles/modules) (let ((mod-file (concat dotfiles/home "/modules/" (symbol-name m) ".org"))) (when (file-exists-p mod-file) (org-babel-load-file mod-file)))) #+end_src
** Writing :PROPERTIES: :header-args: :tangle modules/writing.el :END:
I am using [[https://orgmode.org][org-mode]] extensively for writing projects for different purposes. Most of the improvements are done in the *Core* module for the Literate programming configuration. Encrypt files using symmetric key encryption via PGP. This enables my workflow of storing my personal notes anywhere. Emacs can cache the gpg password if you trust your session.
#+begin_src emacs-lisp (setq epa-file-select-keys 2 epa-file-cache-passphrase-for-symmetric-encryption t epa-file-encrypt-to dotfiles/public-key) #+end_src
Download and install [[https://github.com/integral-dw/org-superstar-mode][org-superstar-mode]] for making headline stars more *super*.
#+begin_src emacs-lisp (use-package org-superstar :after org :hook (org-mode . org-superstar-mode)) #+end_src
*** Roam
#+ATTR_ORG: :width 420px #+ATTR_HTML: :width 420px #+ATTR_LATEX: :width 420px [[./docs/images/2021-02-13-example-roam.png]]
Download and install [[https://orgroam.com][org-roam]], a plain text knowledge management system for Emacs.
#+begin_src emacs-lisp (use-package org-roam :hook (after-init . org-roam-mode) :custom (org-roam-directory org-directory) (org-roam-encrypt-files t) (org-roam-capture-templates '()) (org-roam-dailies-capture-templates '(("d" "Default" entry (function org-roam-capture--get-point) "* %?" :file-name "docs/daily/%<%Y-%m-%d>" :head " ,#+TITLE: %<%Y-%m-%d> ,#+AUTHOR: Christopher James Hayward ")))) #+end_src
Place keybindings behind =SPC r=.
+ Find with =f= + Toggle buffer with =b= + Dailies with =d= + Arbitrary date with =d= + Today with =t= + Tomorrow with =m= + Yesterday with =y=
#+begin_src emacs-lisp (dotfiles/leader "r" '(:ignore t :which-key "Roam") "rf" '(org-roam-find-file :which-key "Find") "rb" '(org-roam-buffer-toggle-display :which-key "Buffer") "rd" '(:ignore t :which-key "Dailies") "rdd" '(org-roam-dailies-find-date :which-key "Date") "rdt" '(org-roam-dailies-find-today :which-key "Today") "rdm" '(org-roam-dailies-find-tomorrow :which-key "Tomorrow") "rdy" '(org-roam-dailies-find-yesterday :which-key "Yesterday")) #+end_src
Visualize the org-roam database with the server, available when the editor is running at http://localhost:8080
#+begin_src emacs-lisp (use-package org-roam-server :hook (org-roam-mode . org-roam-server-mode)) #+end_src
*** Hugo
I use [[https://gohugo.io][Hugo]] for my personal [[https://chrishayward.xyz][website]], which I write in =org-mode= before compiling to =hugo-markdown=. [[https://github.com/kaushalmodi/ox-hugo][ox-hugo]], configured for =one-post-per-file= is my technique for managing my content.
#+begin_src emacs-lisp (use-package ox-hugo :after ox) #+end_src
*** Posts
Add a capture template for creating new blog posts.
#+begin_src emacs-lisp (with-eval-after-load 'org-roam (add-to-list 'org-roam-capture-templates '("p" "Post" plain (function org-roam-capture--get-point) "%?" :file-name "docs/posts/${slug}" :unnarrowed t :head " ,#+TITLE: ${title} ,#+AUTHOR: Christopher James Hayward ,#+DATE: %<%Y-%m-%d>
,#+EXPORT_FILE_NAME: ${slug} ,#+ROAM_KEY: https://chrishayward.xyz/posts/${slug}/
,#+HUGO_BASE_DIR: ../ ,#+HUGO_AUTO_SET_LASTMOD: t ,#+HUGO_SECTION: posts ,#+HUGO_DRAFT: true "))) #+end_src
*** Notes
Add a capture template for creating blog posts and notes on other peoples content / published works.
#+begin_src emacs-lisp (with-eval-after-load 'org-roam (add-to-list 'org-roam-capture-templates '("n" "Notes" plain (function org-roam-capture--get-point) "%?" :file-name "docs/notes/${slug}" :unnarrowed t :head " ,#+TITLE: ${title} ,#+AUTHOR: Christopher James Hayward
,#+EXPORT_FILE_NAME: ${slug} ,#+ROAM_KEY: https://chrishayward.xyz/notes/${slug}/
,#+HUGO_BASE_DIR: ../ ,#+HUGO_AUTO_SET_LASTMOD: t ,#+HUGO_SECTION: notes ,#+HUGO_DRAFT: true "))) #+end_src
*** Slides
Produce high quality presentations that work anywhere with =HTML/JS= and the [[https://revealjs.com][reveal.js]] package. [[https://github.com/hexmode/ox-reveal][ox-reveal]], configured to use a =cdn= allows us to produce ones that are not dependent on a local version of =reveal.js=.
#+begin_src emacs-lisp (use-package ox-reveal :after ox :custom (org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js")) #+end_src
Create a capture template for creating slides quickly, with our desired configuration.
#+begin_src emacs-lisp (with-eval-after-load 'org-roam (add-to-list 'org-roam-capture-templates '("s" "Slides" plain (function org-roam-capture--get-point) "%?" :file-name "docs/slides/${slug}" :unnarrowed t :head " ,#+TITLE: ${title} ,#+AUTHOR: Christopher James Hayward ,#+EMAIL: chris@chrishayward.xyz
,#+REVEAL_ROOT: https://cdn.jsdelivr.net/npm/reveal.js ,#+REVEAL_THEME: serif
,#+EXPORT_FILE_NAME: ${slug}
,#+OPTIONS: reveal_title_slide:nil ,#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil ,#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil "))) #+end_src
*** Agenda
#+ATTR_ORG: :width 420px #+ATTR_HTML: :width 420px #+ATTR_LATEX: :width 420px [[./docs/images/2021-02-13-example-agenda.gif]]
Override ~org-agenda-file-regexp~ to include =.org.gpg= files.
#+begin_src emacs-lisp (unless (string-match-p "\\.gpg" org-agenda-file-regexp) (setq org-agenda-file-regexp (replace-regexp-in-string "\\\\\\.org" "\\\\.org\\\\(\\\\.gpg\\\\)?" org-agenda-file-regexp))) #+end_src
Create a capture template for courses.
#+begin_src emacs-lisp (with-eval-after-load 'org-roam (add-to-list 'org-roam-capture-templates '("c" "Course" plain (function org-roam-capture--get-point) "%?" :file-name "docs/courses/${slug}" :unnarrowed t :head " ,#+TITLE: ${title} ,#+SUBTITLE: ,#+AUTHOR: Christopher James Hayward ,#+EMAIL: chris@chrishayward.xyz
,#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil ,#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil "))) #+end_src
Configure agenda sources. #+begin_src emacs-lisp (setq org-agenda-files '("~/.emacs.d/docs/" "~/.emacs.d/docs/courses/" "~/.emacs.d/docs/daily/")) #+end_src
Open an agenda buffer with =SPC a=.
#+begin_src emacs-lisp (dotfiles/leader "a" '(org-agenda :which-key "Agenda")) #+end_src
*** Images
Capture screenshots with [[https://github.com/tecosaur/screenshot][screenshot.el]].
#+begin_src emacs-lisp (use-package screenshot :commands (screenshot)) #+end_src
Create screencasts with =one-frame-per-action= GIF recording via [[https://github.com/takaxp/emacs-gif-screencast][emacs-gif-screencast]].
+ Pause / Resume + High Quality + Optimized
It requires the installation of ~scrot~, ~gifsicle~, and ~convert~ from the =ImageMagick= library. #+begin_src emacs-lisp (use-package gif-screencast :commands (gif-screencast-start-or-stop gif-screencast-toggle-pause) :custom (gif-screencast-output-directory (concat dotfiles/home "docs/images/"))) #+end_src
Place keybindings behind =SPC s=. + Screenshot with =s= + Screencast with =c=
#+begin_src emacs-lisp (dotfiles/leader "s" '(:ignore t :which-key "Screen") "ss" '(screenshot :which-key "Screenshot") "sc" '(gif-screencast-start-or-stop :which-key "Screencast")) #+end_src
*** Grammar
I use [[https://github.com/bnbeckwith/writegood-mode][writegood-mode]] to find common writing problems such as cliches and poor wording. Grammarly for the peons!
#+begin_src emacs-lisp (use-package writegood-mode :after org :config (writegood-mode)) #+end_src
Toggle ~writegood~ mode with =SPC t w=.
#+begin_src emacs-lisp (dotfiles/leader "tw" '(writegood-mode :which-key "Grammar")) #+end_src
*** Spelling
Use the built in =ispell= package to add spell checking features to buffers.
#+begin_src emacs-lisp (use-package ispell :after org :custom (ispell-dictionary dotfiles/lang)) #+end_src
Toggle highlighting within buffers with =SPC t s=.
#+begin_src emacs-lisp (dotfiles/leader "ts" '(flyspell-buffer :which-key "Spelling")) #+end_src
** Projects :PROPERTIES: :header-args: :tangle modules/projects.el :END:
An IDE like experience (or better) can be achieved in Emacs using two *Microsoft* open source initiatives.
+ [[https://microsoft.github.io/language-server-protocol/][Language Server Protocol]] + [[https://microsoft.github.io/debug-adapter-protocol/][Debug Adapter Protocol]]
Add support for language servers with [[https://emacs-lsp.github.io/lsp-mode/][lsp-mode]]. #+begin_src emacs-lisp (use-package lsp-mode :commands (lsp lsp-deferred) :custom (lsp-idle-delay (* 5 dotfiles/idle))) #+end_src
[[https://emacs-lsp.github.io/lsp-ui/][lsp-ui]] provides UI improvements for =lsp-mode=.
#+begin_src emacs-lisp (use-package lsp-ui :after lsp :custom (lsp-ui-doc-position 'at-point) (lsp-ui-doc-delay 0.500)) #+end_src
[[https://emacs-lsp.github.io/dap-mode/][Dap-mode]] adds support for the debug adapter protocol to Emacs.
#+begin_src emacs-lisp (use-package dap-mode :commands (dap-debug)) #+end_src
*** Containers
Use ~docker~ for running containers. Download and install https://github.com/Silex/docker.el, allowing us to manage containers within Emacs.
#+begin_src emacs-lisp (use-package docker :commands (docker)) #+end_src
Open the management screen with =SPC k=.
#+begin_src emacs-lisp (dotfiles/leader "k" '(docker :which-key "Docker")) #+end_src
*** Management
Configure [[https://projectile.mx][projectile]], a project interaction library for Emacs. It provides a nice set of features for operating on a project level without introducing external dependencies.
#+begin_src emacs-lisp (use-package projectile :custom (projectile-project-search-path '("~/.local/source")) :config (projectile-mode)) #+end_src
*** Completion
Text completion framework via =company= aka *Complete Anything*.
http://company-mode.github.io/ + Integrate with =lsp-mode= #+begin_src emacs-lisp (use-package company :after lsp)
(use-package company-lsp :after (lsp company) :custom (company-backend 'company-lsp)) #+end_src
*** Passwords
Pass makes managing passwords extremely easy, encrypring them in a file structure and providing easy commands for generating, modify, and copying passwords. =password-store.el= provides a wrapper for the functionality within Emacs.
#+begin_src emacs-lisp (use-package password-store :custom (password-store-dir dotfiles/passwords)) #+end_src
Configure keybindings behind =SPC p=. + Copy with =p= + Rename with =r= + Generate with =g=
#+begin_src emacs-lisp (dotfiles/leader "p" '(:ignore t :which-key "Passwords") "pp" '(password-store-copy :which-key "Copy") "pr" '(password-store-rename :which-key "Rename") "pg" '(password-store-generate :which-key "Generate")) #+end_src
*** Languages
Support for individual languages are implemented here.
**** Go Install the =gopls= language server.
#+begin_src sh :tangle no GO111MODULE=on go get golang.org/x/tools/gopls@latest #+end_src
Set the ~GOPATH~ environment variable prior to loading, this allows us to change the default value of ~$HOME/go~ to ~$HOME/.go~.
#+begin_src emacs-lisp (setenv "GOPATH" (concat (getenv "HOME") "/.go/")) #+end_src
Additionally, include the =bin= subdirectory of the ~$GOPATH~ in the ~$PATH~ variable, adding compiled golang programs.
#+begin_src emacs-lisp (setenv "PATH" (concat (getenv "GOPATH") "bin:" (getenv "PATH"))) #+end_src
Finally we can include the =go-mode= package, integrating it with =lsp=.
#+begin_src emacs-lisp (use-package go-mode :hook (go-mode . lsp) :custom (lsp-go-gopls-server-path "~/.go/bin/gopls")) #+end_src
Apply some custom behaviour before saving:
+ Format buffer + Organize imports
#+begin_src emacs-lisp (defun dotfiles/go-hook () (add-hook 'before-save-hook #'lsp-format-buffer t t) (add-hook 'before-save-hook #'lsp-organize-imports t t)) #+end_src #+begin_src emacs-lisp (add-hook 'go-mode-hook #'dotfiles/go-hook) #+end_src
Add a golang source code block structure template with ~<go~:
#+begin_src emacs-lisp (add-to-list 'org-structure-template-alist '("go" . "src go")) #+end_src
**** HTTP
Instead of the popular =restclient= package, I use [[https://github.com/zweifisch/ob-http][ob-http]] as a lightweight alternative.
#+begin_src emacs-lisp (use-package ob-http :after org :config (org-babel-do-load-languages 'org-babel-load-languages '((http . t)))) #+end_src
**** C/C++
#+ATTR_ORG: :width 420px #+ATTR_HTML: :width 420px #+ATTR_LATEX: :width 420px [[./docs/images/2021-02-13-example-ccls.gif]]
Add support for C/C++ languages.
+ Configure the [[https://github.com/MaskRay/ccls][ccls]] language server + Load babel language modules for C/C++ + Create a new structure templates for C/C++ - ~<cc~ for C - ~<cpp~ for C++ #+begin_src emacs-lisp (use-package ccls :hook ((c-mode c++-mode objc-mode cuda-mode) . (lambda () (require 'ccls) (lsp-deferred))) :config (add-to-list 'org-structure-template-alist '("cc" . "src C")) (add-to-list 'org-structure-template-alist '("cpp" . "src C++")) (org-babel-do-load-languages 'org-babel-load-languages '((C . t)))) #+end_src
**** Python
Install the =pyls= language server.
#+begin_src shell :tangle no pip3 install --user "python-language-server[all]" #+end_src
[[https://www.emacswiki.org/emacs/PythonProgrammingInEmacs][Python-mode]] is an Emacs built in mode.
+ Load the babel language module for Python + Add a python source code block structure template with ~<py~ #+begin_src emacs-lisp (use-package python-mode :hook (python-mode . lsp-deferred) :config (require 'dap-python) (add-to-list 'org-src-lang-modes '("python" . python)) (add-to-list 'org-structure-template-alist '("py" . "src python")) (org-babel-do-load-languages 'org-babel-load-languages '((python . t))) :custom (python-shell-interpreter "python3") ;; Required if "python" is not python 3. (dap-python-executable "python3") ;; Same as above. (dap-python-debugger 'debugpy)) #+end_src
**** PlantUML
Download and install [[https://plantuml.com][PlantUML]], a text-based markup language for creating UML diagrams.
+ Load the babel language module for PlantUML + Create a structure template with ~<pl~
#+begin_src emacs-lisp (use-package plantuml-mode :after org :custom (plantuml-default-exec-mode 'jar) (plantuml-jar-path "~/.local/bin/plantuml.jar") (org-plantuml-jar-path (expand-file-name "~/.local/bin/plantuml.jar")) (org-startup-with-inline-images t) :config (add-to-list 'org-src-lang-modes '("plantuml" . plantuml)) (add-to-list 'org-structure-template-alist '("pl" . "src plantuml")) (org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t)))) #+end_src
Toggle inline images with =SPC t i=.
#+begin_src emacs-lisp (dotfiles/leader "ti" '(org-toggle-inline-images :which-key "Images")) #+end_src
** Interface :PROPERTIES: :header-args: :tangle modules/interface.el :END:
#+ATTR_ORG: :width 420px #+ATTR_HTML: :width 420px #+ATTR_LATEX: :width 420px [[./docs/images/what-is-emacs-teaser.png]]
*Bring Emacs out of the eighties*
*** Ivy
Download and configure [[https://oremacs.com/swiper/][ivy]], a powerful selection menu for Emacs.
#+begin_src emacs-lisp (use-package ivy :diminish :config (ivy-mode 1)) #+end_src
Counsel is a customized set of commands to replace built in completion buffers.
#+begin_src emacs-lisp (use-package counsel :after ivy :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only) :config (counsel-mode 1)) #+end_src
Switch buffers with =SPC , (comma)=.
#+begin_src emacs-lisp (dotfiles/leader "," '(counsel-switch-buffer :which-key "Buffers")) #+end_src
Provide more information about each item with [[https://github.com/Yevgnen/ivy-rich][ivy-rich]].
#+begin_src emacs-lisp (use-package ivy-rich :after counsel :init (ivy-rich-mode 1)) #+end_src
*** Fonts
Write out to all *3* of Emacs' default font faces.
#+begin_src emacs-lisp (set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size) (set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size) (set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size) #+end_src
Define a transient keybinding for scaling the text. #+begin_src emacs-lisp (defhydra hydra-text-scale (:timeout 4) "Scale" ("j" text-scale-increase "Increase") ("k" text-scale-decrease "Decrease") ("f" nil "Finished" :exit t)) #+end_src
Increase the font size in buffers with =SPC t f=. + Increase =j= + Decrease =k= + Finish =f=
#+begin_src emacs-lisp (dotfiles/leader "tf" '(hydra-text-scale/body :which-key "Font")) #+end_src
*** Lines
Relative line numbers are important when using =VI= emulation keys. You can prefix most commands with a *number*, allowing you to jump up / down by a line count.
#+begin_example 5: 4: 3: 2: 1: 156: << CURRENT LINE >> 1: 2: 3: 4: 5: #+end_example
https://github.com/emacsmirror/linum-relative + Integrate with ~display-line-numbers-mode~ for performance
#+begin_src emacs-lisp (use-package linum-relative :commands (linum-relative-global-mode) :custom (linum-relative-backend 'display-line-numbers-mode)) #+end_src
Add line numbers to the toggles behind =SPC t l=.
#+begin_src emacs-lisp (dotfiles/leader "tl" '(linum-relative-global-mode :which-key "Lines")) #+end_src
https://github.com/Fanael/rainbow-delimiters + Colourize nested parenthesis
#+begin_src emacs-lisp (use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode)) #+end_src
*** Themes
#+ATTR_ORG: :width 420px #+ATTR_HTML: :width 420px #+ATTR_LATEX: :width 420px [[./docs/images/what-is-emacs-customizable.gif]]
Cherry pick a few modules from =doom-emacs=. High quality and modern colour themes are provided in the [[https://github.com/hlissner/emacs-doom-themes][doom-themes]] package.
#+begin_src emacs-lisp (use-package doom-themes :init (load-theme 'doom-moonlight t)) #+end_src
[[https://github.com/seagle0128/doom-modeline][doom-modeline]] provides an elegant status bar / modeline.
#+begin_src emacs-lisp (use-package doom-modeline :custom (doom-modeline-height 16) :config (doom-modeline-mode 1)) #+end_src
Load a theme with =SPC t t=.
#+begin_src emacs-lisp (dotfiles/leader "tt" '(counsel-load-theme t t :which-key "Theme")) #+end_src
*** Pretty
Make programming buffers prettier with [[https://github.com/pretty-mode/pretty-mode][pretty-mode]], complimentary to the built in ~prettify-symbols-mode~.
#+begin_src emacs-lisp (use-package pretty-mode :hook (python-mode . turn-on-pretty-mode)) #+end_src
*** Ligatures
Enable font ligatures via [[https://github.com/jming422/fira-code-mode][fira-code-mode]], perform this action *only* when ~Fira Code~ is the current font.
#+begin_src emacs-lisp (when (display-graphic-p) (use-package fira-code-mode :hook (prog-mode org-mode))) #+end_src
Toggle global ligature mode with =SPC t g=.
#+begin_src emacs-lisp (dotfiles/leader "tg" '(global-fira-code-mode :which-key "Ligatures")) #+end_src
*** Dashboard
#+ATTR_ORG: :width 420px #+ATTR_HTML: :width 420px #+ATTR_LATEX: :width 420px [[./docs/images/desktop.png]]
Present a dashboard when first launching Emacs. Customize the buttons of the navigator:
+ Brain @ http://localhost:8080 + Homepage @ https://chrishayward.xyz + Athabasca @ https://login.athabascau.ca/cas/login + Bookshelf @ https://online.vitalsource.com
#+begin_src emacs-lisp (use-package dashboard :custom (dashboard-center-content t) (dashboard-set-init-info t) (dashboard-set-file-icons t) (dashboard-set-heading-icons t) (dashboard-set-navigator t) (dashboard-startup-banner 'logo) (dashboard-projects-backend 'projectile) (dashboard-items '((projects . 5) (recents . 5) (agenda . 10))) (dashboard-navigator-buttons `(((,(all-the-icons-fileicon "brain" :height 1.1 :v-adjust 0.0) "Brain" "Knowledge base" (lambda (&rest _) (browse-url "http://localhost:8080")))) ((,(all-the-icons-material "public" :height 1.1 :v-adjust 0.0) "Homepage" "Personal website" (lambda (&rest _) (browse-url "https://chrishayward.xyz")))) ((,(all-the-icons-faicon "university" :height 1.1 :v-adjust 0.0) "Athabasca" "Univeristy login" (lambda (&rest _) (browse-url "https://login.athabascau.ca/cas/login")))) ((,(all-the-icons-faicon "book" :height 1.1 :v-adjust 0.0) "Bookshelf" "Vitalsource bookshelf" (lambda (&rest _) (browse-url "https://online.vitalsource.com")))))) :config (dashboard-setup-startup-hook)) #+end_src
When running in *daemon* mode, ensure that the dashboard is the initial buffer.
#+begin_src emacs-lisp (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) #+end_src
|