summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/emacs.el646
-rw-r--r--config/emacs.org6
-rw-r--r--config/index.org4
-rw-r--r--config/kmonad.org720
-rw-r--r--config/qtile.org398
5 files changed, 3 insertions, 1771 deletions
diff --git a/config/emacs.el b/config/emacs.el
deleted file mode 100644
index 794d021..0000000
--- a/config/emacs.el
+++ /dev/null
@@ -1,646 +0,0 @@
-(use-package emacs
-:custom
-;; global defaults
-(indent-tabs-mode nil "no real tabs, only spaces")
-(tab-width 2 "tab show as 2 spaces")
-(standard-indent 2 "base indentation")
-
-;; Startup errors
-(warning-minimum-level :emergency "Supress emacs warnings")
-(confirm-kill-processes nil "Don't ask to quit")
-(debug-ignored-errors (cons 'remote-file-error debug-ignored-errors) "Remove annoying error from debug errors")
-(browse-url-generic-program "firefox")
-(browse-url-secondary-browser-function 'browse-url-generic)
-(browse-url-browser-function 'browse-url-generic)
-
-;; Mouse wheel
-(mouse-wheel-scroll-amount '(1 ((shift) . 1)) "Nicer scrolling")
-(mouse-wheel-progressive-speed nil "Make scrolling non laggy")
-(mouse-wheel-follow-mouse 't "Scroll correct window")
-(scroll-conservatively 101 "Sort of smooth scrolling")
-(scroll-step 1 "Scroll one line at a time")
-(display-time-24hr-format t "Use 24 hour format to read the time")
- (display-line-numbers-type 'relative "Relative line numbers for easy vim jumping")
- (use-short-answers t "Use y instead of yes")
- (make-backup-files nil "Don't make backups")
- (display-fill-column-indicator-column 150 "Draw a line at 100 characters")
- (fill-column 150)
- (line-spacing 2 "Default line spacing")
- (c-doc-comment-style '((c-mode . doxygen)
- (c++-mode . doxygen)))
-
- :hook ((text-mode . visual-line-mode)
- (prog-mode . display-line-numbers-mode)
- (prog-mode . display-fill-column-indicator-mode)
- (org-mode . auto-fill-mode)
- (org-mode . display-fill-column-indicator-mode)
- (org-mode . display-line-numbers-mode)
- (org-mode . (lambda ()
- (setq prettify-symbols-alist
- '(("#+begin_src" . ?)
- ("#+BEGIN_SRC" . ?)
- ("#+end_src" . ?)
- ("#+END_SRC" . ?)
- ("#+begin_example" . ?)
- ("#+BEGIN_EXAMPLE" . ?)
- ("#+end_example" . ?)
- ("#+END_EXAMPLE" . ?)
- ("#+header:" . ?)
- ("#+HEADER:" . ?)
- ("#+name:" . ?﮸)
- ("#+NAME:" . ?﮸)
- ("#+results:" . ?)
- ("#+RESULTS:" . ?)
- ("#+call:" . ?)
- ("#+CALL:" . ?)
- (":PROPERTIES:" . ?)
- (":properties:" . ?)
- ("lambda" . ?λ)
- ("->" . ?→)
- ("map" . ?↦)
- ("/=" . ?≠)
- ("!=" . ?≠)
- ("==" . ?≡)
- ("<=" . ?≤)
- (">=" . ?≥)
- ("&&" . ?∧)
- ("||" . ?∨)
- ("sqrt" . ?√)
- ("..." . ?…)))
- (prettify-symbols-mode)))
- (prog-mode .
- (lambda ()
- (setq prettify-symbols-alist
- '(("lambda" . ?λ)
- ("->" . ?→)
- ("map" . ?↦)
- ("/=" . ?≠)
- ("!=" . ?≠)
- ("==" . ?≡)
- ("<=" . ?≤)
- (">=" . ?≥)
- ("&&" . ?∧)
- ("||" . ?∨)
- ("sqrt" . ?√)
- ("..." . ?…)))
- (prettify-symbols-mode))))
- :config
- (require 'tex-site)
- (server-start)
-
- ;; start wiith sane defaults
- (pixel-scroll-precision-mode 1)
- (display-battery-mode 1)
- (display-time-mode 1)
- (menu-bar-mode -1)
- (scroll-bar-mode -1)
- (tool-bar-mode -1)
-
- ;; load theme, fonts, and transparency. Prettify symbols.
- (global-prettify-symbols-mode 1)
- (set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 130)
- (set-frame-parameter nil 'alpha-background 70)
- (add-to-list 'default-frame-alist '(alpha-background . 70)))
-
-(use-package org
- :hook
- ((org-mode-hook . (lambda () (remove-hook 'post-self-insert-hook #'yaml-electric-bar-and-angle t))))
- :custom
- (org-confirm-babel-evaluate nil "Don't ask to evaluate code block")
- (org-export-with-broken-links t "publish website even with broken links")
- (org-src-fontify-natively t "Colors!")
- (org-latex-preview-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location")
- (org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location")
- (TeX-PDF-mode t)
- (org-latex-compiler "xelatex" "Use latex as default")
- (org-latex-pdf-process '("xelatex -interaction=nonstopmode -output-directory=%o %f") "set xelatex as default")
- (TeX-engine 'xetex "set xelatex as default engine")
- (preview-default-option-list '("displaymath" "textmath" "graphics") "preview latex")
- (preview-image-type 'png "Use PNGs")
- (org-format-latex-options (plist-put org-format-latex-options :scale 1.5) "space latex better")
- (org-return-follows-link t "be able to follow links without mouse")
- (org-habit-preceding-days 7 "See org habit entries")
- (org-habit-following-days 35 "See org habit entries")
- (org-habit-show-habits t "See org habit entries")
- (org-habit-show-habits-only-for-today nil "See org habit entries")
- (org-habit-show-all-today t "Show org habit graph")
- (org-startup-indented t "Indent the headings")
- (org-image-actual-width '(300) "Cap width")
- (org-startup-with-latex-preview t "see latex previews on opening file")
- (org-startup-with-inline-images t "See images on opening file")
- (org-hide-emphasis-markers t "prettify org mode")
- (org-use-sub-superscripts "{}" "Only display superscripts and subscripts when enclosed in {}")
- (org-pretty-entities t "prettify org mode")
- (org-agenda-files (list "~/monorepo/agenda.org" "~/org/notes.org" "~/org/agenda.org") "set default org files")
- (org-default-notes-file (concat org-directory "/notes.org") "Notes file")
- (org-publish-project-alist
- '(("website-org"
- :base-directory "~/monorepo"
- :base-extension "org"
- :publishing-directory "~/website_html"
- :recursive t
- :publishing-function org-html-publish-to-html
- :headline-levels 4
- :html-preamble t
- :html-preamble-format (("en" "<p class=\"preamble\"><a href=\"/index.html\">home</a> | <a href=\"./index.html\">section main page</a></p><hr>")))
- ("website-static"
- :base-directory "~/monorepo"
- :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml\\|svg"
- :publishing-directory "~/website_html/"
- :recursive t
- :publishing-function org-publish-attachment)
- ("website" :auto-sitemap t :components ("website-org" "website-static"))) "functions to publish website")
- (org-html-postamble (concat "Copyright © 2024 " system-fullname) "set copyright notice on bottom of site")
- :config
- (require 'ox-publish)
- (require 'org-tempo)
- (require 'org-habit)
- (org-babel-do-load-languages 'org-babel-load-languages
- '((shell . t)
- (python . t)
- (latex . t))))
-
-(use-package unicode-fonts
- :init (unicode-fonts-setup))
-
-(use-package electric-pair
- :hook ((prog-mode . electric-pair-mode)
- (org-mode . (lambda () (setq-local electric-pair-inhibit-predicate (lambda (c) (if (eq c ?<) t (electric-pair-default-inhibit c))))))))
-
-(use-package wgrep
- :after grep)
-
-(defun insert-urandom-password (&optional length)
- (interactive "P")
- (let ((length (or length 32))
- (chars "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+[]{};:,.<>?"))
- (insert
- (with-temp-buffer
- (call-process "head" nil t nil "-c" (number-to-string length) "/dev/urandom")
- (let ((bytes (buffer-string)))
- (mapconcat (lambda (c)
- (string (elt chars (mod (string-to-char (char-to-string c)) (length chars)))))
- bytes ""))))))
-
-(use-package org-fragtog :hook (org-mode . org-fragtog-mode))
-
-(use-package yasnippet
- :config
- (add-to-list 'yas-snippet-dirs "~/monorepo/yasnippet/")
- (yas-global-mode 1)
- :hook (org-mode . (lambda () (yas-minor-mode) (yas-activate-extra-mode 'latex-mode))))
-
-(use-package company
- :config
- '(add-to-list 'company-backends '(company-ispell company-capf company-yasnippet company-files))
- :hook ((after-init . global-company-mode)))
-
-(use-package ispell
- :custom
- (ispell-program-name "aspell" "use aspell")
- (ispell-silently-savep t "Save changes to dict without confirmation")
- (ispell-dictionary "en" "Use english dictionary")
- (ispell-alternate-dictionary "~/.local/share/dict" "dict location"))
-
-(use-package flyspell
- :hook (text-mode . flyspell-mode))
-
-(use-package evil
- :custom
- (evil-want-keybinding nil "Don't load a whole bunch of default keybindings")
- :config
- (evil-mode 1)
- (evil-set-undo-system 'undo-redo)
- (evil-set-initial-state 'pdf-view-mode 'normal)
- ;; bind / and ? safely after evil is loaded
- (define-key evil-normal-state-map (kbd "/") 'swiper)
- (define-key evil-normal-state-map (kbd "?")
- (lambda () (interactive) (swiper "--reverse"))))
-
-(use-package evil-collection
- :after (evil)
- :config
- (with-eval-after-load 'evil-maps
- (define-key evil-motion-state-map (kbd "SPC") nil)
- (define-key evil-motion-state-map (kbd "RET") nil)
- (define-key evil-motion-state-map (kbd "TAB") nil))
- (evil-collection-init))
-
-
-(use-package evil-commentary
- :after (evil)
- :config
- (evil-commentary-mode))
-
-(use-package evil-org
- :after (evil org)
- :hook (org-mode . (lambda () evil-org-mode))
- :config
- (require 'evil-org-agenda)
- (evil-org-agenda-set-keys))
-
-(use-package which-key
- :config
- (which-key-mode))
-
-(use-package page-break-lines
- :init
- (page-break-lines-mode))
-
-(use-package org-journal
- :after (org)
- :custom
- (org-journal-dir "~/monorepo/journal/" "Set journal directory")
- (org-journal-date-format "%A, %d %B %Y" "Date format")
- (org-journal-file-format "%Y%m%d.org" "Automatic file creation format based on date")
- (org-journal-enable-agenda-integration t "All org-journal entries are org-agenda entries")
- :init
- (defun org-journal-file-header-func (time)
- "Custom function to create journal header."
- (concat
- (pcase org-journal-file-type
- (`daily "#+TITLE: Daily Journal\n#+STARTUP: showeverything\n#+DESCRIPTION: My daily journal entry\n#+AUTHOR: Preston Pan\n#+HTML_HEAD: <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\" />\n#+html_head: <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n#+html_head: <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n#+options: broken-links:t")
- (`weekly "#+TITLE: Weekly Journal\n#+STARTUP: folded")
- (`monthly "#+TITLE: Monthly Journal\n#+STARTUP: folded")
- (`yearly "#+TITLE: Yearly Journal\n#+STARTUP: folded"))))
- (setq org-journal-file-header 'org-journal-file-header-func))
-
-(use-package doom-modeline
- :config
- (doom-modeline-mode 1))
-
-(use-package doom-themes
- :ensure t
- :custom
- (doom-themes-enable-bold t)
- (doom-themes-enable-italic t)
- (doom-themes-treemacs-theme "doom-rouge")
- :config
- (load-theme 'doom-rouge t)
-
- (doom-themes-visual-bell-config)
- (doom-themes-treemacs-config)
- (doom-themes-org-config))
-;; (load-theme 'catppuccin :no-confirm)
-
-(use-package writegood-mode
- :hook (text-mode . writegood-mode))
-
-(use-package org-superstar
- :after (org)
- :hook (org-mode . (lambda () (org-superstar-mode 1))))
-
-;; (use-package eglot
- ;; :hook
- ;; (prog-mode . eglot-ensure)
- ;; (nix-mode . eglot-ensure)
- ;; :config
- ;; (add-to-list 'eglot-server-programs '(nix-mode . ("nil"))))
-
- (use-package lsp
- :hook
- (prog-mode . lsp))
-
-(with-eval-after-load 'lsp-mode
- (setq lsp-typescript-format-enable t
- lsp-typescript-indent-size 4
- lsp-typescript-tab-size 4
- lsp-typescript-indent-style "spaces"))
-
-(use-package editorconfig
- :config
- (editorconfig-mode 1))
-
- (use-package flycheck
- :config (global-flycheck-mode))
-
- (use-package platformio-mode
-:hook (prog-mode . platformio-conditionally-enable))
-
-(use-package irony-mode
- :hook (
- (c++-mode . irony-mode)
- (c-mode . irony-mode)
- (objc-mode . irony-mode)
- (irony-mode . irony-cdb-autosetup-compile-options)))
-
-(use-package irony-eldoc
- :hook ((irony-mode . irony-eldoc)))
-
-(use-package solidity-mode)
-(use-package company-solidity)
-(use-package solidity-flycheck
- :custom
- (solidity-flycheck-solc-checker-active t))
-
-(use-package projectile
- :custom
- (projectile-project-search-path '("~/org" "~/src" "~/monorepo" "~/projects") "search path for projects")
- :config
- (projectile-mode +1))
-
-(use-package dashboard
- :after (projectile)
- :custom
- (dashboard-banner-logo-title "Welcome, Commander!" "Set title for dashboard")
- (dashboard-icon-type 'nerd-icons "Use nerd icons")
- (dashboard-vertically-center-content t "Center content")
- (dashboard-set-init-info t)
- (dashboard-week-agenda t "Agenda in dashboard")
- (dashboard-items '((recents . 5)
- (bookmarks . 5)
- (projects . 5)
- (agenda . 5)
- (registers . 5)) "Look at some items")
- :config
- (dashboard-setup-startup-hook))
-
-(use-package counsel)
-
-(use-package ivy
- :custom
- (ivy-use-virtual-buffers t "Make searching more efficient")
- (enable-recursive-minibuffers t "Don't get soft locked when in a minibuffer")
- :bind
- ("C-s" . swiper)
- ("C-c C-r" . ivy-resume)
- ("M-x" . counsel-M-x)
- ("C-x C-f" . counsel-find-file)
- ("<f1> f" . counsel-describe-function)
- ("<f1> v" . counsel-describe-variable)
- ("<f1> o" . counsel-describe-symbol)
- ("<f1> l" . counsel-find-library)
- ("<f2> i" . counsel-info-lookup-symbol)
- ("<f2> u" . counsel-unicode-char)
- ("C-c g" . counsel-git)
- ("C-c j" . counsel-git-grep)
- ("C-c k" . counsel-ag)
- ("C-x l" . counsel-locate)
- :config
- (ivy-mode))
-(define-key ivy-minibuffer-map (kbd "C-j") 'ivy-immediate-done)
-
-(use-package magit)
-
-(use-package erc
- :custom
- (erc-nick system-username "sets erc username to the one set in nix config")
- (erc-user-full-name system-fullname "sets erc fullname to the one set in nix config"))
-
-(use-package general
- :init
- (defun prestonpan ()
- (interactive)
- (erc-tls :server "nullring.xyz"
- :port "6697"))
- (defun liberachat ()
- (interactive)
- (erc-tls :server "irc.libera.chat"
- :port "6697"))
- (defun efnet ()
- (interactive)
- (erc-tls :server "irc.prison.net"
- :port "6697"))
- (defun matrix-org ()
- (interactive)
- (ement-connect))
- (defun gimp-org ()
- (interactive)
- (erc-tls :server "irc.gimp.org"
- :port "6697"))
- :config
- (general-create-definer leader-key :prefix "SPC")
- (leader-key 'normal
- "o c" '(org-capture :wk "Capture")
-
- ;; Org Mode
- "n" '(:ignore t :wk "Org mode plugins")
- "n j j" '(org-journal-new-entry :wk "Make new journal entry")
- "n r f" '(org-roam-node-find :wk "Find roam node")
- "n r i" '(org-roam-node-insert :wk "Insert roam node")
- "n r a" '(org-roam-alias-add :wk "Add alias to org roam node")
- "n r g" '(org-roam-graph :wk "Graph roam database")
- "m I" '(org-id-get-create :wk "Make org id")
-
- ;; Programming Projects
- "." '(counsel-find-file :wk "find file")
- "p a" '(projectile-add-known-project :wk "Add to project list")
-
- "N f" '(nix-flake :wk "nix flake menu")
- "f" '(:ignore t :wk "file operations")
- "f p" '(projectile-switch-project :wk "find project to switch to")
- "f f" '(counsel-fzf :wk "find file in project")
- "f s" '(counsel-rg :wk "find string in project")
-
- "y n s" '(yas-new-snippet :wk "Create new snippet")
-
- "g" '(:ignore t :wk "Magit")
- "g /" '(magit-dispatch :wk "git commands")
- "g P" '(magit-push :wk "git push")
- "g c" '(magit-commit :wk "git commit")
- "g p" '(magit-pull :wk "Pull from git")
- "g s" '(magit-status :wk "Change status of files")
- "g i" '(magit-init :wk "init new git project")
-
- "o p" '(treemacs :wk "Project Drawer")
- "o P" '(treemacs-projectile :wk "Import Projectile project to treemacs")
-
- "w r" '(writeroom-mode :wk "focus mode for writing")
-
- ;; Applications
- "o" '(:ignore t :wk "Open application")
- "o t" '(vterm :wk "Terminal")
- "o e" '(eshell :wk "Elisp Interpreter")
- "o m" '(mu4e :wk "Email")
- "o M" '(matrix-org :wk "Connect to matrix")
- "o r s" '(elfeed :wk "rss feed")
- "o a" '(org-agenda :wk "Open agenda")
- "o w" '(eww :wk "web browser")
- "m m" '(emms :wk "Music player")
- "s m" '(proced :wk "System Manager")
- "l p" '(list-processes :wk "List Emacs Processes")
-
- "m P p" '(org-publish :wk "Publish website components")
- "s e" '(sudo-edit :wk "Edit file with sudo")
-
- ;; "f f" '(eglot-format :wk "Format code buffer")
- "i p c" '(prestonpan :wk "Connect to my IRC server")
- "i l c" '(liberachat :wk "Connect to libera chat server")
- "i e c" '(efnet :wk "Connect to efnet chat server")
- "i g c" '(gimp-org :wk "Connect to gimp chat server")
-
- ;; Documentation
- "h" '(:ignore t :wk "Documentation")
- "h v" '(counsel-describe-variable :wk "Describe variable")
- "h f" '(counsel-describe-function :wk "Describe function")
- "h h" '(help :wk "Help")
- "h m" '(woman :wk "Manual")
- "h i" '(info :wk "Info")
-
- "s i p" '(insert-urandom-password :wk "insert random password to buffer (for sops)")
-
- "h r r" '(lambda () (interactive) (org-babel-load-file (expand-file-name "~/monorepo/config/emacs.org")))))
-
-(use-package ellama
- :custom
- (ellama-sessions-directory "~/org/ellama/" "Set org directory for LLM sessions")
- :init
- (require 'llm-ollama)
- (setopt ellama-provider (make-llm-ollama
- :host "localhost"
- :chat-model "qwen2.5:14b")))
-
-(use-package minuet
- :bind
- (("M-y" . #'minuet-complete-with-minibuffer)
- ("C-c m" . #'minuet-show-suggestion)
- :map minuet-active-mode-map
- ("C-c r" . #'minuet-dismiss-suggestion)
- ("TAB" . #'minuet-accept-suggestion))
-
- :init
- (add-hook 'prog-mode-hook #'minuet-auto-suggestion-mode)
-
- :custom
- (minuet-request-timeout 40 "Max timeout in seconds")
- (minuet-provider 'openai-fim-compatible "FIM compatible OpenAI-like API (Ollama)")
- (minuet-n-completions 1 "I am using ghost text so I only need one possible completion")
- (minuet-context-window 1024 "how much context do I want?")
-
- :config
- (plist-put minuet-openai-fim-compatible-options :end-point "http://localhost:11434/v1/completions")
-
- (plist-put minuet-openai-fim-compatible-options :name "Ollama")
- (plist-put minuet-openai-fim-compatible-options :api-key "TERM")
- (plist-put minuet-openai-fim-compatible-options :model "qwen2.5-coder:14b")
-
- (minuet-set-optional-options minuet-openai-fim-compatible-options :max_tokens 50))
-
-(use-package elfeed
- :custom
- (elfeed-search-filter "@1-month-ago +unread" "Only display unread articles from a month ago")
- :hook ((elfeed-search-mode . elfeed-update)))
-
-(use-package elfeed-org
- :custom
- (rmh-elfeed-org-files '("~/monorepo/config/elfeed.org") "Use elfeed config in repo as default")
- :config
- (elfeed-org))
-
-(use-package elfeed-tube
- :after elfeed
- :demand t
- :config
- (elfeed-tube-setup)
- :bind (:map elfeed-show-mode-map
- ("F" . elfeed-tube-fetch)
- ([remap save-buffer] . elfeed-tube-save)
- :map elfeed-search-mode-map
- ("F" . elfeed-tube-fetch)
- ([remap save-buffer] . elfeed-tube-save)))
-
-(use-package elfeed-tube-mpv
- :bind (:map elfeed-show-mode-map
- ("C-c C-f" . elfeed-tube-mpv-follow-mode)
- ("C-c C-c" . elfeed-tube-mpv)
- ("C-c C-w" . elfeed-tube-mpv-where)
- :map elfeed-search-mode-map
- ("M" . elfeed-tube-mpv)))
-
-(use-package treemacs)
-(use-package treemacs-evil
- :after (treemacs evil))
-(use-package treemacs-projectile
- :after (treemacs projectile))
-(use-package treemacs-magit
- :after (treemacs magit))
-
-(use-package eww
- :custom
- (search-engines
- '((("google" "g") "https://google.com/search?q=%s")
- (("duckduckgo" "d" "ddg") "https://duckduckgo.com/?q=%s")
- (("rfc" "r") "https://www.rfc-editor.org/rfc/rfc%s.txt")
- (("rfc-kw" "rk") "https://www.rfc-editor.org/search/rfc_search_detail.php?title=%s"))
- "use this set of search engines")
-
- (search-engine-default "google" "Use google as default")
- (eww-search-prefix "https://google.com/search?q=" "Google prefix")
- :hook ((eww-mode . (lambda () (local-set-key (kbd "y Y") #'eww-copy-page-url)))))
-
-(use-package org-roam
- :after (org)
- :custom
- (org-roam-db-update-on-save t "Update org-roam db")
- (org-roam-graph-viewer "firefox" "Use firefox to view org-roam graph")
- (org-roam-directory (file-truename "~/monorepo/mindmap") "Set org-roam directory inside monorepo")
- (org-roam-capture-templates '(("d" "default" plain "%?"
- :target (file+head "${title}.org"
- "#+title: ${title}\n#+author: Preston Pan\n#+html_head: <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\" />\n#+html_head: <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n#+html_head: <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n#+options: broken-links:t")
- :unnarrowed t)) "org-roam files start with this snippet by default")
- :config
- (org-roam-db-autosync-mode)
- ;; Otherwise links are broken when publishing
- (org-roam-update-org-id-locations))
-
-(use-package org-roam-ui
- :after org-roam
- :hook (after-init . org-roam-ui-mode)
- :custom
- (org-roam-ui-sync-theme t "Use emacs theme for org-roam-ui")
- (org-roam-ui-follow t "Have cool visual while editing org-roam")
- (org-roam-ui-update-on-save t "This option is obvious")
- (org-roam-ui-open-on-start t "Have cool visual open in firefox when emacs loads"))
-
-(use-package pinentry
- :custom (epa-pinentry-mode `loopback "Set this option to match gpg-agent.conf")
- :config (pinentry-start))
-
-(use-package smtpmail
- :custom
- (user-mail-address system-email "Use our email")
- (user-full-name system-fullname "Use our full name")
- (sendmail-program "msmtp" "Use msmtp in order to send emails")
- (send-mail-function 'smtpmail-send-it "This is required for this to work")
- (message-sendmail-f-is-evil t "Use evil-mode for sendmail")
- (message-sendmail-extra-arguments '("--read-envelope-from") "idk what this does")
- (message-send-mail-function 'message-send-mail-with-sendmail "Use sendmail"))
-
-(use-package mu4e
- :after smtpmail
- :custom
- (mu4e-drafts-folder "/Drafts" "Set drafts folder mu db")
- (mu4e-sent-folder "/Sent" "Set sent folder in mu db")
- (mu4e-trash-folder "/Trash" "Set trash folder in mu db")
- (mu4e-attachment-dir "~/Downloads" "Set downloads folder for attachments")
- (mu4e-view-show-addresses 't "Show email addresses in main view")
- (mu4e-confirm-quit nil "Don't ask to quit")
- (message-kill-buffer-on-exit t "Kill buffer when I exit mu4e")
- (mu4e-compose-dont-reply-to-self t "Don't include self in replies")
- (mu4e-change-filenames-when-moving t)
- (mu4e-get-mail-command (concat "mbsync " system-username) "Use mbsync for imap")
- (mu4e-compose-reply-ignore-address (list "no-?reply" system-email) "ignore my own address and noreply")
- (mu4e-html2text-command "w3m -T text/html" "Use w3m to convert html to text")
- (mu4e-update-interval 300 "Update duration")
- (mu4e-headers-auto-update t "Auto-updates feed")
- (mu4e-view-show-images t "Shows images")
- (mu4e-compose-signature-auto-include nil)
- (mu4e-use-fancy-chars t "Random option to make mu4e look nicer"))
-
-(use-package emms
- :custom
- (emms-source-file-default-directory (expand-file-name "~/music/") "Use directory specified in Nix")
- (emms-player-mpd-music-directory (expand-file-name "~/music/") "Use directory specified in Nix")
- (emms-player-mpd-server-name "localhost" "Connect to localhost")
- (emms-player-mpd-server-port "6600" "Connect to port 6600")
- (emms-player-list '(emms-player-mpd) "Use mpd")
- :init
- (emms-all)
- (add-to-list 'emms-info-functions 'emms-info-mpd)
- (add-to-list 'emms-player-list 'emms-player-mpd)
- :config (emms-player-mpd-connect))
-
-(use-package lean4-mode
- :commands lean4-mode
- :vc (:url "https://github.com/leanprover-community/lean4-mode.git"
- :rev "76895d8939111654a472cfc617cfd43fbf5f1eb6"))
diff --git a/config/emacs.org b/config/emacs.org
index 7ee1d4b..b792212 100644
--- a/config/emacs.org
+++ b/config/emacs.org
@@ -1,6 +1,6 @@
-#+TITLE: Emacs Configuration
-#+AUTHOR: Preston Pan
-#+DESCRIPTION: my personal emacs configuration for nixOS
+#+title: Emacs Configuration
+#+author: Preston Pan
+#+description: my personal emacs configuration for NixOS
#+html_head: <link rel="stylesheet" type="text/css" href="../style.css" />
* Introduction
This is my Vanilla Emacs configuration, made to work with my NixOS configuration. For that
diff --git a/config/index.org b/config/index.org
index 6057e11..4ec24b1 100644
--- a/config/index.org
+++ b/config/index.org
@@ -24,13 +24,9 @@ Here is a list of my configurations for various programs:
#+end_src
#+RESULTS:
-- [[file:doom.org][Doom Literate Config]]
- [[file:elfeed.org][Interesting RSS Feeds]]
- [[file:emacs.org][Emacs Configuration]]
-- [[file:fish.org][Fish RC File]]
-- [[file:kmonad.org][KMonad Configuration]]
- [[file:nix.org][NixOS Configuration]]
-- [[file:qtile.org][My Qtile Config (Mocha)]]
- [[file:qutebrowser.org][Qutebrowser Configuration]]
@@html: </div>@@
diff --git a/config/kmonad.org b/config/kmonad.org
deleted file mode 100644
index 4f38a86..0000000
--- a/config/kmonad.org
+++ /dev/null
@@ -1,720 +0,0 @@
-#+title: KMonad Configuration
-#+author: Preston Pan
-#+description: My Literate KMonad Configuration
-#+html_head: <link rel="stylesheet" type="text/css" href="../style.css" />
-
-* Goals
-** It should be the most efficient keyboard layout possible.
-*** Ergonomic key positions and more frequent keys closer to home row.
-*** Optimize the layers in such a way where we do not need to change layer frequently
-however, layers are still needed because it is sometimes more economical to switch layers rather than to reach.
-
-* Configuration
-** Initial Values
-We must set our initial values for the configuration:
-#+begin_src kbd :tangle config.kbd
-(defcfg
- input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd")
- output (uinput-sink "My KMonad output"
- "/usr/bin/sleep 1 && /usr/bin/setxkbmap -option compose:ralt")
- cmp-seq ralt ;; Set the compose key to `RightAlt'
- cmp-seq-delay 5 ;; 5ms delay between each compose-key sequence press
- fallthrough true
- allow-cmd true
-)
-#+end_src
-you need to set your input device according to your hardware.
-** defsrc
-The defsrc block specifies the default layout that our keyboard uses. Note that when you are,
-for example, using a 40% keyboard, some of these keys will not be present.
-However, it is still syntactically valid and you will be able to use this
-configuration.
-#+begin_src kbd :tangle config.kbd
-(defsrc
- grv 1 2 3 4 5 6 7 8 9 0 - = bspc
- tab q w e r t y u i o p [ ] \
- caps a s d f g h j k l ; ' ret
- lsft z x c v b n m , . / rsft
- lctl lmet lalt spc ralt rmet cmp rctl
-)
-#+end_src
-Also note that the defsrc block is not used for custom key configuration. It
-is used only to describe the shape of the current keyboard.
-** defalias
-defalias defines aliases for buttons. Buttons are used in deflayer blocks
-in order to remap the keys.
-#+begin_src kbd :tangle config.kbd
-(defalias
- num (layer-toggle numbers)
- kil C-A-del
-)
-#+end_src
-** deflayer
-#+begin_src kbd :tangle config.kbd
-#| --------------------------------------------------------------------------
- Necessary: at least 1 `deflayer` block
-
- It is also important to mention that the 'keymap' in KMonad is modelled as a
- stack of layers (just like in QMK). When an event is registered we look in the
- top-most layer for a handler. If we don't find one we try the next layer, and
- then the next.
-
- Exactly what 'evaluates-to-a-button' will be expanded on in more detail below.
- There are very many different specialist buttons in KMonad that we will touch
- upon. However, for now, these 4 are a good place to begin:
-
- 1. Any keycode evaluates to a button that, on press, emits the press of that
- keycode, and on release, emits the release of that keycode. Just a 'normal'
- button. The exception is '\', which gets used as an escape character. Use
- '\\' instead. Other characters that need to be escaped to match the literal
- character are '(', ')', and '_'.
-
- 2. An @-prefixed name evaluates to an alias lookup. We named two buttons in
- the `defalias` block above, we could now refer to these buttons using
- `@num` and `@kil`. This is also why we only use alias-names no longer than
- 3 characters in this tutorial. Also, note that we are already referencing
- some aliases that have not yet been defined, this is not an issue.
-
- 3. The '_' character evaluates to transparent. I.e. no handler for that
- key-event in this layer, causing this event to be handed down the layer
- stack to perhaps be handled by the next layer.
-
- 4. The 'XX' character evaluates to blocked. I.e. no action bound to that
- key-event in this layer, but do actually catch event, preventing any
- underlying layer from handling it.
-
- Finally, it is important to note that the *first* `deflayer` statement in a
- KMonad config will be the layer that is active when KMonad starts up.
-
- -------------------------------------------------------------------------- |#
-
-
-(deflayer qwerty
- grv 1 2 3 4 5 6 7 8 9 0 - = bspc
- tab q w e r t y u i o p [ ] \
- esc a s d f g h j k l ; ' ret
- lsft z x c v b n m , . / rsft
- lctl lmet lalt spc @num rmet @sym rctl
-)
-
-(deflayer numbers
- _ _ _ _ _ _ _ _ _ _ _ _ _ _
- _ _ _ _ _ XX / 7 8 9 - _ _ _
- _ _ _ _ _ XX * 4 5 6 + _ _
- _ _ \( \) . XX 0 1 2 3 _ _
- _ _ _ _ _ _ _ _
-)
-
-#+end_src
-
-#+begin_src kbd :tangle config.kbd
-#| --------------------------------------------------------------------------
- Optional: modded buttons
-
- Let's start by exploring the various special buttons that are supported by
- KMonad by looking at 'modded' buttons, that is to say, buttons that activate
- some kind of 'mod', then perform some button, and finally release that 'mod'
- again.
-
- We have already seen an example of this style of button, our `kil` button is
- one such button. Let's look at it in more detail:
- C-A-del
-
- This looks like a simple declarative statement, but it's helpful to realize
- that is simply syntactic sugar around 2 function calls. This statement is
- equivalent to:
- (around ctl (around alt del))
-
- This highlights a core design principle in KMonad: we try to provide very
- simple buttons, and then we provide rules and functions for combining them
- into new buttons. Although note: still very much a work in progress.
-
- So, looking at this statement:
- (around foo bar)
-
- Here, `around` is a function that takes two buttons and creates a new button.
- This new button will, on a press, first press foo, then press bar, and on a
- release first release bar, and then foo. Once created, this new button can be
- passed to anything in KMonad that expects a button.
-
- We have already seen other examples of modded buttons, \(, \), *, and +. There
- are no Keycodes for these buttons in KMonad, but they are buttons. They simply
- evaluate to `(around lsft x)`. All shifted numbers have their corresponding
- characters, the same is true for all capitals, and < > : ~ " | { } \_ + and ?.
-
- To wrap up 'modded-buttons', let's look back at C-A-del. We have 8 variants:
- C- : (around lctl X)
- A- : (around lalt X)
- M- : (around lmet X)
- S- : (around lsft X)
-
- Then RC-, RA-, RM-, and RS- behave exactly the same, except using the
- right-modifier.
-
- These can be combined however you please:
- C-A-M-S-x ;; Perfectly valid
- C-% ;; Perfectly valid: same as C-S-5
- C-RC-RA-A-M-S-RS-m ;; Sure, but why would you?
-
- Also, note that although we provide special syntax for certain modifiers,
- these buttons are in no way 'special' in KMonad. There is no concept of 'modifier'.
- (around a (around b c)) ;; Perfectly valid
-
- -------------------------------------------------------------------------- |#
-
-(defalias
-
- ;; Something useful
- cpy C-c
- pst C-v
- cut C-x
-
- ;; Something silly
- md1 (around a (around b c)) ;; abc
- md2 (around a (around lsft b)) ;; aB
- md3 C-A-M-S-l
- md4 (around % b) ;; BEWARE: %B, not %b, do you see why?
-)
-
-#| --------------------------------------------------------------------------
- Optional: sticky keys
-
- KMonad also support so called "sticky keys". These are keys that will
- behave as if they were pressed after just tapping them. This behaviour
- wears off after the next button is pressed, which makes them ideal for
- things like a quick control or shift. For example, tapping a sticky and
- then pressing `abc' will result in `Abc'.
-
- You can create these keys with the `sticky-key' keyword:
-
- (defalias
- slc (sticky-key 500 lctl))
-
- The number after `sticky-key' is the timeout you want, in milliseconds. If
- a key is tapped and that time has passed, it won't act like it's pressed
- down when we receive the next keypress.
-
- It is also possible to combine sticky keys. For example, to
- get a sticky shift+control you can do
-
- (defalias
- ssc (around
- (sticky-key 500 lsft)
- (sticky-key 500 lctl)))
-
- -------------------------------------------------------------------------- |#
-
-;; Let's make both shift keys sticky
-(defalias
- sl (sticky-key 300 lsft)
- sr (sticky-key 300 rsft))
-
-
-;; Now we define the 'tst' button as opening and closing a bunch of layers at
-;; the same time. If you understand why this works, you're starting to grok
-;; KMonad.
-;;
-;; Explanation: we define a bunch of testing-layers with buttons to illustrate
-;; the various options in KMonad. Each of these layers makes sure to have its
-;; buttons not overlap with the buttons from the other layers, and specifies all
-;; its other buttons as transparent. When we use the nested `around` statement,
-;; whenever we push the button linked to '@tst' (check `qwerty` layer, we bind
-;; it to `rctl`), any button we press when holding `rctl` will be pressed in the
-;; context of those 4 layers overlayed on the stack. When we release `rctl`, all
-;; these layers will be popped again.
-(defalias tst (around (layer-toggle macro-test)
- (around (layer-toggle layer-test)
- (around (layer-toggle around-next-test)
- (around (layer-toggle command-test)
- (layer-toggle modded-test))))))
-
-(deflayer modded-test
- _ _ _ _ _ _ _ _ _ _ _ _ _ _
- _ _ @md4 _ _ _ _ _ _ _ _ _ _ _
- _ _ @md1 @md2 @md3 _ _ _ _ _ _ _ _
- _ _ @cut @cpy @pst _ _ _ _ _ _ _
- _ _ _ _ _ _ _ _
-)
-
-#| --------------------------------------------------------------------------
- Optional: tap-macros
-
- Let's look at a button we haven't seen yet, tap-macros.
-
- `tap-macro` is a function that takes an arbitrary number of buttons and
- returns a new button. When this new button is pressed it rapidly taps all its
- stored buttons in quick succesion except for its last button, which it only
- presses. This last button gets released when the `tap-macro` gets released.
-
- There are two ways to define a `tap-macro`, using the `tap-macro` function
- directly, or through the #() syntactic sugar. Both evaluate to exactly the
- same button.
-
- (tap-macro K M o n a d)
- #(K M o n a d)
-
- If you are going to use a `tap-macro` to perform a sequence of actions inside
- some program you probably want to include short pauses between inputs to give
- the program time to register all the key-presses. Therefore we also provide
- the 'pause' function, which simply pauses processing for a certain amount of
- milliseconds. Pauses can be created like this:
-
- (pause 20)
- P20
-
- You can also pause between each key stroke by specifying the `:delay' keyword,
- as well as a time in ms, at the end of a `tap-macro':
-
- (tap-macro K M o n a d :delay 5)
- #(K M o n a d :delay 5)
-
- The above would be equivalent to e.g.
-
- (tap-macro K P5 M P5 o P5 n P5 a P5 d)
-
- The `tap-macro-release` is like `tap-macro`, except that it
- waits to press the last button when the `tap-macro-release`
- gets released. It might be useful when combined with a
- footswitch that sends keyboard scan codes.
-
- (tap-macro-release i K M o n a d esc)
-
- WARNING: DO NOT STORE YOUR PASSWORDS IN PLAIN TEXT OR IN YOUR KEYBOARD
-
- I know it might be tempting to store your password as a macro, but there are 2
- huge risks:
- 1. You accidentally leak your config and expose your password
- 2. Anyone who knows about the button can get clear-text representation of your
- password with any text editor, shell, or text-input field.
-
- Support for triggering shell commands directly from KMonad is described in the
- command buttons section below.
-
- This concludes this public service announcement.
-
- -------------------------------------------------------------------------- |#
-
-(defalias
- mc1 #(K M o n a d)
- mc2 #(C-c P50 A-tab P50 C-v) ;; Careful, this might do something
- mc3 #(P200 h P150 4 P100 > < P50 > < P20 0 r z 1 ! 1 ! !)
- mc4 (tap-macro a (pause 50) @md2 (pause 50) c)
- mc5 (tap-macro-release esc esc esc)
- mc6 #(@mc3 spc @mc3 spc @mc3)
-)
-
-(deflayer macro-test
- _ @mc1 @mc2 @mc3 @mc4 @mc5 @mc6 _ _ _ _ _ _ _
- _ _ _ _ _ _ _ _ _ _ _ _ _ _
- _ _ _ _ _ _ _ _ _ _ _ _ _
- _ _ _ _ _ _ _ _ _ _ _ _
- _ _ _ _ _ _ _ _
-)
-
-
-#| --------------------------------------------------------------------------
- Optional: layer manipulation
-
- You have already seen the basics of layer-manipulation. The `layer-toggle`
- button. This button adds a layer to the top of KMonad's layer stack when
- pressed, and removes it again when released. There are a number of other ways
- to manipulate the layer stack, some safer than others. Let's go through all of
- them from safest to least safe:
-
- `layer-toggle` works as described before, 2 things to note:
- 1. If you are confused or worried about pressing a key, changing layers, and
- then releasing a key and this causing issues: don't be. KMonad handles
- presses and releases in very different ways. Presses get passed directly to
- the stacked keymap as previously described. When a KMonad button has its
- press-action triggered, it then registers a callback that will catch its
- own release before we ever touch the keymap. This guarantees that the
- button triggered by the press of X *will be* the button whose release is
- triggered by the release of X (the release of X might trigger other things
- as well, but that is besides the point.)
- 2. If `layer-toggle` can only ever add and then necessarily remove 1 layer
- from the stack, then it will never cause a permanent change, and is
- perfectly safe.
-
- `layer-delay`, once pressed, temporarily switches to some layer for some
- milliseconds. Just like `layer-toggle` this will never permanently mess-up the
- layer stack. This button was initially implemented to provide some
- 'leader-key' style behavior. Although I think in the future better solutions
- will be available. For now this will temporarily add a layer to the top of the
- stack:
- (layer-delay 500 my-layer)
-
- `layer-next`, once pressed, primes KMonad to handle the next press from some
- arbitrary layer. This aims to fill the same usecase as `layer-delay`: the
- beginnings of 'leader-key' style behavior. I think this whole button will get
- deleted soon, because the more general `around-next` now exists (see below)
- and this is nothing more than:
- (around-next (layer-toggle layer-name))
- Until then though, use `layer-next` like this:
- (layer-next layer-name)
-
- `layer-switch`: change the base-layer of KMonad. As described at the top of
- this document, the first `deflayer` statement is the layer that is active when
- KMonad starts. Since `layer-toggle` can only ever add on and remove from the
- top of that, it can never change the base-layer. The following button will
- unregister the bottom-most layer of the keymap, and replace it with another
- layer.
- (layer-switch my-layer)
-
- This is where things start getting potentially dangerous (i.e. get KMonad into
- an unusuable state until a restart has occured). It is perfectly possible to
- switch into a layer that you can never get out of. Or worse, you could
- theoretically have a layer full of only `XX`s and switch into that, rendering
- your keyboard unuseable until you somehow manage to kill KMonad (without using
- your keyboard).
-
- However, when handled well, `layer-switch` is very useful, letting you switch
- between 'modes' for your keyboard. I have a tiny keyboard with a weird keymap,
- but I switch into a simple 'qwerty' keymap shifted 1 button to the right for
- gaming. Just make sure that any 'mode' you switch into has a button that
- allows you to switch back out of the 'mode' (or content yourself restarting
- KMonad somehow).
-
- `layer-add` and `layer-rem`. This is where you can very quickly cause yourself
- a big headache. Originally I didn't expose these operations, but someone
- wanted to use them, and I am not one to deny someone else a chainsaw. As the
- names might give away:
- (layer-add name) ;; Add a layer to the top of the stack
- (layer-rem name) ;; Remove a layer by name (noop if no such layer)
-
- To use `layer-add` and `layer-rem` well, you should take a moment to think
- about how to create a layout that will prevent you from getting into
- situations where you enter a key-configuration you cannot get out of again.
- These two operations together, however, are very useful for activating a
- permanent overlay for a while. This technique is illustrated in the tap-hold
- overlay a bit further down.
-
-
- -------------------------------------------------------------------------- |#
-
-(defalias
-
- yah (layer-toggle asking-for-trouble) ;; Completely safe
- nah (layer-add asking-for-trouble) ;; Completely unsafe
-
- ld1 (layer-delay 500 numbers) ;; One way to get a leader-key
- ld2 (layer-next numbers) ;; Another way to get a leader key
-
- ;; NOTE, this is safe because both `qwerty` and `colemak` contain the `@tst`
- ;; button which will get us to the `layer-test` layer, which itself contains
- ;; both `@qwe` and `@col`.
- qwe (layer-switch qwerty) ;; Set qwerty as the base layer
- col (layer-switch colemak) ;; Set colemak as the base layer
-)
-(deflayer layer-test
- @qwe _ _ _ _ _ _ _ _ _ _ @add _ @nah
- @col _ _ _ _ _ _ _ _ _ _ _ _ @yah
- _ _ _ _ _ _ _ _ _ _ _ _ _
- _ _ _ _ _ _ _ _ _ @ld1 @ld2 _
- _ _ _ _ _ _ _ _
-)
-
-;; Exactly like qwerty, but with the letters switched around
-(deflayer colemak
- grv 1 2 3 4 5 6 7 8 9 0 - = bspc
- tab q w f p g j l u y ; [ ] \
- @xcp a r s t d h n e i o ' ret
- @sl z x c v b k m , . / @sr
- lctl @num lalt spc ralt rmet @sym @tst
-)
-
-(defalias lol #(: - D))
-
-;; Contrived example
-(deflayer asking-for-trouble
- @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol
- @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol
- @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol
- @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol @lol
- @lol @lol @lol @lol @lol @lol @lol @lol
-)
-
-;; One way to safely use layer-add and layer-rem: the button bound to layer-add
-;; is the same button bound to layer-rem in the layer that `add` adds to the
-;; stack. I.e., it becomes impossible to add or remove multiple copies of a
-;; layer.
-(defalias
- add (layer-add multi-overlay) ;; multi-overlay is defined in the next
- rem (layer-rem multi-overlay) ;; section below this
- )
-
-#| --------------------------------------------------------------------------
- Optional: Multi-use buttons
-
- Perhaps one of the most useful features of KMonad, where a lot of work has
- gone into, but also an area with many buttons that are ever so slightly
- different. The naming and structuring of these buttons might change sometime
- soon, but for now, this is what there is.
-
- For the next section being able to talk about examples is going to be handy,
- so consider the following scenario and mini-language that will be the same
- between scenarios.
- - We have some button `foo` that will be different between scenarios
- - `foo` is bound to 'Esc' on the input keyboard
- - the letters a s d f are bound to themselves
- - Px signifies the press of button x on the keyboard
- - Rx signifies the release of said button
- - Tx signifies the sequential and near instantaneous press and release of x
- - 100 signifies 100ms pass
-
- So for example:
- Tesc Ta:
- tap of 'Esc' (triggering `foo`), tap of 'a' triggering `a`
- Pesc 100 Ta Tb Resc:
- press of 'Esc', 100ms pause, tap of 'a', tap of 'b', release of 'Esc'
-
- The `tap-next` button takes 2 buttons, one for tapping, one for holding, and
- combines them into a single button. When pressed, if the next event is its own
- release, we tap the 'tapping' button. In all other cases we first press the
- 'holding' button then we handle the event. Then when the `tap-next` gets
- released, we release the 'holding' button.
-
- So, using our mini-language, we set foo to:
- (tap-next x lsft)
- Then:
- Tesc -> x
- Tesc Ta -> xa
- Pesc Ta Resc -> A
- Pesc Ta Tr Resc -> AR
-
- The `tap-hold` button is very similar to `tap-next` (a theme, trust me). The
- difference lies in how the decision is made whether to tap or hold. A
- `tap-hold` waits for a particular timeout, if the `tap-hold` is released
- anywhere before that moment we execute a tap immediately. If the timeout
- occurs and the `tap-hold` is still held, we switch to holding mode.
-
- The additional feature of a `tap-hold` is that it pauses event-processing
- until it makes its decision and then rolls back processing when the decision
- has been made.
-
- So, again with the mini-language, we set foo to:
- (tap-hold 200 x lsft) ;; Like tap-next, but with a 200ms timeout
- Then:
- Tesc -> x
- Tesc Ta -> xa
- Pesc 300 a -> A (the moment you press a)
- Pesc a 300 -> A (after 200 ms)
- Pesc a 100 Resc -> xa (both happening immediately on Resc)
-
- The `tap-hold-next` button is a combination of the previous 2. Essentially,
- think of it as a `tap-next` button, but it also switches to held after a
- period of time. This is useful, because if you have a (tap-next ret ctl) for
- example, and you press it thinking you want to press C-v, but then you change
- your mind, you now cannot release the button without triggering a 'ret', that
- you then have to backspace. With the `tap-hold-next` button, you simply
- outwait the delay, and you're good. I see no benefit of `tap-next` over
- `tap-hold-next` with a decent timeout value.
-
- You can use the `:timeout-button` keyword to specify a button other than the
- hold button which should be held when the timeout expires. For example, we
- can construct a button which types one x when tapped, multiple x's when held,
- and yet still acts as shift when another button is pressed before the timeout
- expires. So, using the minilanguage and foo as:
- (tap-hold-next 200 x lsft :timeout-button x)
- Then:
- Tesc -> Tx
- Pesc 100 a -> A (the moment you press a)
- Pesc 5000 Resc -> xxxxxxx (some number of auto-repeated x's)
-
- Note that KMonad does not itself auto-repeat the key. In this last example,
- KMonad emits 200 Px 4800 Rx, and the operating system's auto-repeat feature,
- if any, emits multiple x's because it sees that the x key is held for 4800 ms.
-
- The `tap-next-release` is like `tap-next`, except it decides whether to tap or
- hold based on the next release of a key that was *not* pressed before us. This
- also performs rollback like `tap-hold`. So, using the minilanguage and foo as:
- (tap-next-release x lsft)
- Then:
- Tesc Ta -> xa
- Pa Pesc Ra Resc -> ax (because 'a' was already pressed when we started, so
- foo decides it is tapping)
- Pesc Pa Resc Ra -> xa (because the first release we encounter is of esc)
- Pesc Ta Resc -> A (because a was pressed *and* released after we started,
- so foo decides it is holding)
-
- `tap-next-press` is also a lot like `tap-next`, but decides whether to tap or
- hold based on whether another key is pressed before this one is released.
- Using the minilanguage:
- (tap-next-press x lsft)
- Then:
- Tesc Ta -> xa
- Pa Pesc Ra Resc -> ax (because esc is released before another key is pressed)
- Pesc Pa Resc Ra -> A (because a is pressed before esc is released)
- Pesc Ta Resc -> A (a is pressed before esc is released here as well)
-
- These increasingly stranger buttons are, I think, coming from the stubborn
- drive of some of my more eccentric (and I mean that in the most positive way)
- users to make typing with modifiers on the home-row more comfortable.
- Especially layouts that encourage a lot of rolling motions are nicer to use
- with the `release` style buttons.
-
- The `tap-hold-next-release` (notice a trend?) is just like `tap-next-release`,
- but it comes with an additional timeout that, just like `tap-hold-next` will
- jump into holding-mode after a timeout.
-
- I honestly think that `tap-hold-next-release`, although it seems the most
- complicated, probably is the most comfortable to use. But I've put all of them
- in a testing layer down below, so give them a go and see what is nice.
-
- -------------------------------------------------------------------------- |#
-
-
-(defalias
- xtn (tap-next x lsft) ;; Shift that does 'x' on tap
- xth (tap-hold 400 x lsft) ;; Long delay for easier testing
- thn (tap-hold-next 400 x lsft)
- tnr (tap-next-release x lsft)
- tnp (tap-next-press x lsft)
- tnh (tap-hold-next-release 2000 x lsft)
-
- ;; Used it the colemak layer
- xcp (tap-hold-next 400 esc ctl)
-)
-
-;; Some of the buttons used here are defined in the next section
-(deflayer multi-overlay
- @mt _ _ _ _ _ _ _ _ _ _ _ @rem _
- _ _ _ _ _ _ _ _ _ _ _ _ _ _
- @thn _ _ _ _ _ _ _ _ _ _ _ _
- @xtn _ _ _ _ _ _ _ _ _ _ @xth
- @tnr @tnp _ _ _ _ _ @tnh
-)
-
-
-#| --------------------------------------------------------------------------
- Optional: Multi-tap
-
- Besides the tap-hold style buttons there is another multi-use button (with.
- only 1 variant, at the moment). The `multi-tap`.
-
- A `multi-tap` codes for different buttons depending on how often it is tapped.
- It is defined by a series of delays and buttons, followed by a last button
- without delay. As long as you tap the `multi-tap` within the delay specified,
- it will jump to the next button. Once the delay is exceeded the selected
- button is pressed. If the last button in the list is reached, it is
- immediately pressed. When another key is pressed down while we're tapping,
- `multi-tap' also immediately exits and taps the current button.
-
- Note that you can actually hold the button, so in the below example, going:
- tap-tap-hold (wait 300ms) will get you a pressed c, until you release again.
-
- -------------------------------------------------------------------------- |#
-
-(defalias
- mt (multi-tap 300 a 300 b 300 c 300 d e))
-
-
-#| --------------------------------------------------------------------------
- Optional: Around-next
-
- The `around-next` function creates a button that primes KMonad to perform the
- next button-press inside some context. This could be the context of 'having
- Shift pressed' or 'being inside some layer' or, less usefully, 'having d
- pressed'. It is a more general and powerful version of `layer-next`.
-
- There is also an `around-next-timeout` button that does the same thing as
- `around-next`, except that if some other button press is not detected within
- some timeout, some other button is tapped. This can be used to create a
- leader-key that simply times out (by passing a non-button), or a key that can
- still function as a normal key, but also as a leader key when used slowly.
-
- I think expansion of this button-style is probably the future of leader-key,
- hydra-style functionality support in KMonad.
-
- -------------------------------------------------------------------------- |#
-
-(defalias
- ns (around-next sft) ;; Shift the next press
- nnm (around-next @num) ;; Perform next press in numbers layer
- ntm (around-next-timeout 500 sft XX)
-
-
-)
-
-(deflayer around-next-test
- _ _ _ _ _ _ _ _ _ _ _ _ _ _
- _ _ _ _ _ _ _ _ _ _ _ _ _ _
- @ns _ _ _ _ _ _ _ _ _ _ _ _
- @nnm _ _ _ _ _ _ _ _ _ _ _
- @ntm _ _ _ _ _ _ _
-)
-
-#| --------------------------------------------------------------------------
- Optional: Compose-key sequences
-
- Compose-key sequences are series of button-presses that your operating system
- will interpret as the insertion of a special character, like accented
- characters, or various special-languages. In that sense, they are just
- syntactic sugar for keyboard macros.
-
- To get this to work on Linux you will need to set your compose-key with a tool
- like `setxkbmap', as well as tell kmonad that information. See the `defcfg'
- block at the top of this file for a working example. Note that you need to
- wait ever so slightly for the keyboard to register with linux before the
- command gets executed, that's why the `sleep 1`. Also, note that all the
- `/run/current-system' stuff is because the author uses NixOS. Just find a
- shell-command that will:
-
- 1. Sleep a moment
- 2. Set the compose-key to your desired key
-
- Please be aware that what `setxkbmap' calls the `menu' key is not actually the
- `menu' key! If you want to use the often suggested
-
- setxkbmap -option compose:menu
-
- you will have to set your compose key within kmonad to `compose' and not
- `menu'.
-
- After this, this should work out of the box under Linux. Windows does not
- recognize the same compose-key sequences, but WinCompose will make most of the
- sequences line up with KMonad: http://wincompose.info/
- This has not in any way been tested on Mac.
-
- In addition to hard-coded symbols, we also provide 'uncompleted' macros. Since
- a compose-key sequence is literally just a series of keystrokes, we can omit
- the last one, and enter the sequence for 'add an umlaut' and let the user then
- press some letter to add this umlaut to. These are created using the `+"`
- syntax.
-
- -------------------------------------------------------------------------- |#
-
-(defalias
- sym (layer-toggle symbols)
-
-)
-
-(deflayer symbols
- _ _ _ _ _ _ _ _ _ _ _ _ _ _
- _ ä é © _ _ _ _ _ _ _ _ _ _
- _ +' +~ +` +^ _ _ _ _ _ _ _ _
- _ +" +, _ _ _ _ _ _ _ _ _
- _ _ _ _ _ _ _ _)
-
-
-#| --------------------------------------------------------------------------
- Optional: Command buttons
-
- Currently we also provide the ability to launch arbitrary shell-commands from
- inside kmonad. These commands are simply handed off to the command-shell
- without any further checking or waiting.
-
- NOTE: currently only tested on Linux, but should work on any platform, as long
- as the command is valid for that platform.
-
- The `cmd-button' function takes two arguments, the second one of which is
- optional. These represent the commands to be executed on pressing and
- releasing the button respectively.
-
- BEWARE: never run anyone's configuration without looking at it. You wouldn't
- want to push:
-
- (cmd-button "rm -rf ~/*") ;; Delete all this user's data
-
-
- -------------------------------------------------------------------------- |#
-#+end_src
diff --git a/config/qtile.org b/config/qtile.org
deleted file mode 100644
index 6860043..0000000
--- a/config/qtile.org
+++ /dev/null
@@ -1,398 +0,0 @@
-#+title: My Qtile Config (Mocha)
-#+author: Preston Pan
-#+date: <2023-06-09 Fri>
-#+description: a catppuccin qtile configuration written in emacs
-#+html_head: <link rel="stylesheet" type="text/css" href="../style.css" />
-* Goals
-** We want the configuration to have efficient and ergonomic keybindings.
-Commonly used keybindings should be two keys, less common ones should use more.
-** We want it to work with other programs that it references.
-For example, the qutebrowser and qtile configurations should not cause conflict
-and they should have mutual consistency.
-*** This will therefore make the configuration self sufficient.
-** General enough that it will work for most purposes.
-Specialized programs or tools should be in a separate section which will make
-it easy to parse and remove.
-
-* Configuration
-** Imports and Definitions
-All of this is also in the default configuration.
-#+begin_src python :tangle config.py
-from libqtile import bar, layout, widget
-from libqtile.config import Click, Drag, Group, Key, Match, Screen
-from libqtile.lazy import lazy
-from libqtile.utils import guess_terminal
-from libqtile import hook
-from libqtile.backend.wayland import InputConfig
-
-import os
-import subprocess
-
-
-mod = "mod4"
-terminal = "kitty"
-wl_import_rules = None
-auto_minimize = True
-wmname = "LG3D"
-#+end_src
-** Hex Colors
-We then load the catppuccin colors for the bar and window borders.
-#+begin_src python :tangle config.py
-def get_colors(theme):
- if theme == "city-lights":
- return [
- # Normal colors
- '#45475a',
- '#f38ba8',
- '#a6e3a1',
- '#f9e2af',
- '#89b4fa',
- '#f5c2e7',
- '#94e2d5',
- '#bac2de',
-
- # Bright colors
- '#585b70',
- '#f38ba8',
- '#a6e3a1',
- '#f9e2af',
- '#89b4fa',
- '#f5c2e7',
- '#94e2d5',
- '#a6adc8',
-
- # background
- '#1e1e2e',
- # foreground
- '#cdd6f4',
- ]
- elif theme == "gruvbox":
- return [
- # normal colors
- '#282828',
- '#cc241d',
- '#98971a',
- '#d79921',
- '#458588',
- '#b16286',
- '#689d6a',
- '#a89984',
- #bright colors
- '#928374',
- '#fb4934',
- '#b8bb26',
- '#fabd2f',
- '#83a598',
- '#d3869b',
- '#8ec07c',
- '#ebdbb2',
- # background
- '#282828',
- # foreground
- '#ebdbb2',
- ]
-
-colors = get_colors("gruvbox")
-#+end_src
-** Keybindings
-The _keys_ variable is going to be our final list of keybindings. We start by initializing it
-wth our window manipulation bindings with vim keys:
-*** Focus controls
-Vi inspired keybindings to manipulate focus:
-#+begin_src python :tangle config.py
-keys = [
- Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
- Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
- Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
- Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
- Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"),
-
- Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"),
- Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"),
- Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"),
- Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"),
-
- Key([mod, "control"], "h", lazy.layout.grow_left(), desc="Grow window to the left"),
- Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"),
- Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"),
- Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"),
- Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
- Key(
- [mod, "shift"],
- "Return",
- lazy.layout.toggle_split(),
- desc="Toggle between split and unsplit sides of stack",
- ),
- Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
-]
-#+end_src
-*** Quit/Restart
-#+begin_src python :tangle config.py
-keys.extend([
- Key([mod], "q", lazy.window.kill(), desc="Kill focused window"),
- Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
- Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
-])
-#+end_src
-*** Programs
-These are our keybindings for user programs.
-#+begin_src python :tangle config.py
-keys.extend([
- Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
- Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
- Key([mod], "e", lazy.spawn("emacs"), desc="Run emacs"),
- Key([mod], "w", lazy.spawn("qutebrowser"), desc="Run Qutebrowser"),
- Key([mod], "f", lazy.spawn("firefox"), desc="Run Firefox"),
- Key([mod], "b", lazy.spawn("blender"), desc="Run Blender"),
- Key([mod], "p", lazy.spawn("krita"), desc="Run Krita"),
- Key([mod], "v", lazy.spawn("inkscape"), desc="Run Inkscape"),
- Key([mod], "g", lazy.spawn("gimp"), desc="Run GIMP"),
- Key([mod], "t", lazy.spawn("torbrowser-launcher"), desc="Run Tor Browser"),
- Key([mod], "i", lazy.spawn("emacsclient --eval \"(emacs-everywhere)\""), desc="Emacs Everywhere!"),
- Key([mod], "d", lazy.spawn("rofi -show run"), desc="rofi command launcher"),
-])
-#+end_src
-*** XF86
-Now we need keybindings for the function keys:
-#+begin_src python :tangle config.py
-keys.extend([
- Key([], 'XF86AudioLowerVolume', lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%")),
- Key([], 'XF86AudioRaiseVolume', lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%")),
- Key([], 'XF86AudioMute', lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")),
- Key([], 'XF86MonBrightnessUp', lazy.spawn("light -A 10")),
- Key([], 'XF86MonBrightnessDown', lazy.spawn("light -U 10")),
- Key([], 'XF86AudioNext', lazy.spawn("mpc next")),
- Key([], 'XF86AudioPrev', lazy.spawn("mpc prev")),
- Key([], "XF86AudioPlay", lazy.spawn("mpc toggle"), desc="Play/Pause player"),
- Key([], "Print", lazy.spawn("scrot '%Y-%m-%d-%s_screenshot_$wx$h.jpg' -e 'mv $f ~/img/scrot")),
-])
-#+end_src
-** Groups
-Now we name our groups:
-#+begin_src python :tangle config.py
-groups = [Group(i) for i in "123456789"]
-
-for i in groups:
- keys.extend(
- [
- Key(
- [mod],
- i.name,
- lazy.group[i.name].toscreen(),
- desc="Switch to group {}".format(i.name),
- ),
- Key(
- [mod, "shift"],
- i.name,
- lazy.window.togroup(i.name, switch_group=True),
- desc="Switch to & move focused window to group {}".format(i.name),
- ),
- ]
- )
-#+end_src
-** Layouts
-This is our list of enabled layouts. You can enable more of them if you want.
-#+begin_src python :tangle config.py
-layouts = [
- layout.Columns(border_focus=colors[2], border_normal=colors[0], border_width=4, margin=7),
- layout.Max(),
- # Try more layouts by unleashing below layouts.
- # layout.Stack(num_stacks=2),
- # layout.Bsp(),
- # layout.Matrix(),
- layout.MonadTall(border_focus=colors[2], border_normal=colors[0], border_width=4, margin=7),
- # layout.MonadWide(),
- # layout.RatioTile(),
- # layout.Tile(),
- # layout.TreeTab(),
- # layout.VerticalTile(),
- # layout.Zoomy(),
-]
-#+end_src
-** Bar
-Now we define our bar. I only have the need to see the time, current workspace, battery percentage,
-and MPD. Also, you may need to manually change your font size depending on your screen.
-#+begin_src python :tangle config.py
-widget_defaults = dict(
- font="FiraCode Nerd Font",
- fontsize=16,
- padding=4,
- foreground=colors[17],
- background=colors[16],
-)
-extension_defaults = widget_defaults.copy()
-
-# screens = [
-# Screen(
-# top=bar.Bar(
-# [
-# # widget.CurrentLayout(),
-# widget.GroupBox(active=colors[6], inactive=colors[15], this_current_screen_border=colors[4], highlight_colorsr=colors[3]),
-# widget.Prompt(),
-# widget.WindowName(),
-# widget.Chord(
-# chords_colors={
-# "launch": ("#ff0000", "#ffffff"),
-# },
-# name_transform=lambda name: name.upper(),
-# ),
-# # widget.StatusNotifier(),
-
-# widget.Systray(),
-# widget.Battery(charge_char="🔋", discharge_char="🔋", full_char="🔋", format="{char} {percent:2.0%}"),
-# # widget.TextBox("|", foreground=colors[1]),
-# widget.Sep(padding=16, size_percent=80, foreground=colors[1]),
-# widget.Clock(format="🕒 %a %I:%M %p"),
-# widget.Sep(padding=16, size_percent=80, foreground=colors[1]),
-# widget.Mpd2(),
-# widget.TextBox(" "),
-
-# ],
-# 24,
-
-# # border_width=[2, 0, 2, 0], # Draw top and bottom borders
-# # border_colorsr=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta
-# ),
-# bottom=bar.Gap(4),
-# left=bar.Gap(3),
-# right=bar.Gap(3),
-# ),
-# ]
-
-def pline(rl, fg, bg):
- if rl == 0:
- uc = ""
- else:
- uc = ""
- return widget.TextBox(text = uc,
- padding = 0,
- fontsize = 22,
- foreground=fg,
- background=bg)
-
-screens = [
- Screen(
- wallpaper="~/.config/qtile/wallpaper",
- wallpaper_mode="fill",
- top=bar.Bar(
- [
- widget.CurrentLayoutIcon(
- scale=0.75,
- background=colors[3]
- ),
- pline(0, colors[3], colors[6]),
- widget.GroupBox(
- highlight_method="block",
- background=colors[6],
- this_current_screen_border="#7daea3"
- ),
- pline(0, colors[6], colors[7]),
- widget.TaskList(
- highlight_method="block",
- max_title_width=300,
- border="#d3869b",
- padding=2,
- background=colors[7]
- ),
- pline(0, colors[7], colors[0]),
- widget.Spacer(),
-
- pline(1, colors[2], colors[0]),
- widget.Net( # requires python-psutil
- interface="wlp0s20f3",
- format="📡 {total}",
- update_interval=30,
- background=colors[2]
- ),
- pline(1, colors[5], colors[2]),
- widget.Backlight(
- format="💡 {percent:2.0%}",
- backlight_name="intel_backlight",
- background=colors[5]
- ),
- pline(1, colors[3], colors[5]),
- widget.Volume(
- emoji=True,
- background=colors[3]
- ),
- widget.Volume(
- background=colors[3]
- ),
- pline(1, colors[4], colors[3]),
- widget.BatteryIcon(
- background=colors[4]
- ),
- widget.Battery(
- charge_char="now ",
- discharge_char="left",
- format="{percent:2.0%} {char}",
- background=colors[4]
- ),
- pline(1, colors[1], colors[4]),
- widget.Clock(
- format="%Y-%m-%d %a %I:%M %p",
- background=colors[1]
- ),
- ],
- 26,
- ),
- ),
-]
-#+end_src
-** Mouse
-We configure the mouse to interact with floating windows.
-#+begin_src python :tangle config.py
-mouse = [
- Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
- Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
- Click([mod], "Button2", lazy.window.bring_to_front()),
-]
-#+end_src
-
-Also, we need to toggle some options:
-#+begin_src python :tangle config.py
-dgroups_app_rules = [] # type: list
-follow_mouse_focus = True
-bring_front_click = False
-cursor_warp = False
-#+end_src
-
-And then we add the applications that need to start in floating:
-#+begin_src python :tangle config.py
-floating_layout = layout.Floating(
- float_rules=[
- # Run the utility of `xprop` to see the wm class and name of an X client.
- *layout.Floating.default_float_rules,
- Match(wm_class="confirmreset"), # gitk
- Match(wm_class="makebranch"), # gitk
- Match(wm_class="maketag"), # gitk
- Match(wm_class="ssh-askpass"), # ssh-askpass
- Match(title="branchdialog"), # gitk
- Match(title="pinentry"), # GPG key password entry
- ]
-)
-#+end_src
-** I have no idea what these are
-but they work for some reason.
-#+begin_src python :tangle config.py
-auto_fullscreen = True
-focus_on_window_activation = "smart"
-reconfigure_screens = True
-#+end_src
-** Autostart
-If we used wayland, then we must autostart here:
-#+begin_src python :tangle config.py
-@hook.subscribe.startup_once
-def autostart():
- home = os.path.expanduser("~")
- subprocess.call([home + '/.config/qtile/autostart.sh'])
-#+end_src
-** Input Rules
-in wayland, setxkbmap is not possible. Therefore:
-#+begin_src python :tangle config.py
-wl_input_rules = {
- "1267:12377:ELAN1300:00 04F3:3059 Touchpad": InputConfig(left_handed=True),
- "*": InputConfig(left_handed=True, pointer_accel=True),
- "type:keyboard": InputConfig(kb_options="caps:swapescape,compose:ralt"),
-}
-#+end_src