]> git.armaanb.net Git - config.org.git/blob - config.org
mu4e: play with config
[config.org.git] / config.org
1 #+TITLE: System Configuration
2 #+DESCRIPTION: Personal system configuration in org-mode format.
3 #+AUTHOR: Armaan Bhojwani
4 #+EMAIL: me@armaanb.net
5
6 * Welcome
7 Welcome to my system configuration! This file contains my Emacs configuration, but also my config files for many of the other programs on my system!
8 ** Compatability
9 I am currently using GCCEmacs 28 from the feature/native-comp branch, so some settings may not be available for older versions of Emacs. This is a purely personal configuration, so while I can garuntee that it works on my setup, I can't for anything else.
10 ** Choices
11 I chose to create a powerful, yet not overly heavy Emacs configuration. Things like LSP mode are important to my workflow and help me be productive, so despite its weight, it is kept. Things like a fancy modeline or icons on the other hand, do not increase my productivity, and create visual clutter, and thus have been excluded.
12
13 Another important choice has been to integrate Emacs into a large part of my computing environment (see [[*EmacsOS]]). I use Email, IRC, et cetera, all through Emacs which simplifies my workflow.
14
15 Lastly, I use Evil mode. I think modal keybindings are simple and more ergonomic than standard Emacs style, and Vim keybindings are what I'm comfortable with and are pervasive throughout computing.
16 ** TODOs
17 *** TODO Turn keybinding and hook declarations into use-package declarations where possible
18 *** TODO Put configs with passwords in here with some kind of authentication
19 - Offlineimap
20 - irc.el
21 ** License
22 Released under the [[https://opensource.org/licenses/MIT][MIT license]] by Armaan Bhojwani, 2021. Note that many snippets are taken from online, and other sources, who are credited for their work at the snippet.
23 * Package management
24 ** Bootstrap straight.el
25 straight.el is really nice for managing package, and it integrates nicely with use-package. It uses the bootstrapping system defined here for installation.
26 #+begin_src emacs-lisp
27   (defvar bootstrap-version)
28   (let ((bootstrap-file
29          (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
30         (bootstrap-version 5))
31     (unless (file-exists-p bootstrap-file)
32       (with-current-buffer
33           (url-retrieve-synchronously
34            "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
35            'silent 'inhibit-cookies)
36         (goto-char (point-max))
37         (eval-print-last-sexp)))
38     (load bootstrap-file nil 'nomessage))
39 #+end_src
40 ** Replace use-package with straight
41 #+begin_src emacs-lisp
42   (straight-use-package 'use-package)
43   (setq straight-use-package-by-default t)
44 #+end_src
45 * Visual options
46 ** Theme
47 Very nice high contrast theme.
48
49 Its fine to set this here because I run Emacs in daemon mode, but if I were not, then putting it in early-init.el would be a better choice to eliminate the window being white before the theme is loaded.
50 #+begin_src emacs-lisp
51   (setq modus-themes-slanted-constructs t
52         modus-themes-bold-constructs t
53         modus-themes-mode-line '3d
54         modus-themes-scale-headings t
55         modus-themes-diffs 'desaturated)
56   (load-theme 'modus-vivendi t)
57 #+end_src
58 ** Typography
59 *** Font
60 Great programming font with ligatures.
61 #+begin_src emacs-lisp
62   (add-to-list 'default-frame-alist '(font . "JetBrainsMonoNF-12"))
63 #+end_src
64 *** Ligatures
65 #+begin_src emacs-lisp
66   (use-package ligature
67     :straight (ligature :type git :host github :repo "mickeynp/ligature.el")
68     :config
69     (ligature-set-ligatures
70      '(prog-mode text-mode)
71      '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "/=" "/=="
72        "/>" "//" "/*" "*>" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
73        "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>"
74        "<-|" "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>"
75        "</" "<*" "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>"
76        ":=" "::=" "=>>" "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!=="
77        "!!" "!=" ">]" ">:" ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&"
78        "&&" "|||>" "||>" "|>" "|]" "|}" "|=>" "|->" "|=" "||-" "|-"
79        "||=" "||" ".." ".?" ".=" ".-" "..<" "..." "+++" "+>" "++"
80        "[||]" "[<" "[|" "{|" "?." "?=" "?:" "##" "###" "####" "#["
81        "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_" "__" "~~"
82        "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
83     (global-ligature-mode t))
84 #+end_src
85 ** Line numbers
86 Display relative line numbers except in some modes
87 #+begin_src emacs-lisp
88   (global-display-line-numbers-mode)
89   (setq display-line-numbers-type 'relative)
90   (dolist (no-line-num '(term-mode-hook
91                          pdf-view-mode-hook
92                          shell-mode-hook
93                          org-mode-hook
94                          eshell-mode-hook))
95     (add-hook no-line-num (lambda () (display-line-numbers-mode 0))))
96 #+end_src
97 ** Highlight matching parenthesis
98 #+begin_src emacs-lisp
99   (use-package paren
100     :config (show-paren-mode)
101     :custom (show-paren-style 'parenthesis))
102 #+end_src
103 ** Modeline
104 *** Show current function
105 #+begin_src emacs-lisp
106   (which-function-mode)
107 #+end_src
108 *** Make position in file more descriptive
109 Show current column and file size.
110 #+begin_src emacs-lisp
111   (column-number-mode)
112   (size-indication-mode)
113 #+end_src
114 *** Hide minor modes
115 #+begin_src emacs-lisp
116   (use-package minions
117     :config (minions-mode))
118 #+end_src
119 ** Ruler
120 Show a ruler at a certain number of chars depending on mode.
121 #+begin_src emacs-lisp
122   (setq display-fill-column-indicator-column 80)
123   (global-display-fill-column-indicator-mode)
124 #+end_src
125 ** Keybinding hints
126 Whenever starting a key chord, show possible future steps.
127 #+begin_src emacs-lisp
128   (use-package which-key
129     :config (which-key-mode)
130     :custom (which-key-idle-delay 0.3))
131 #+end_src
132 ** Highlight TODOs in comments
133 #+begin_src emacs-lisp
134   (use-package hl-todo
135     :straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
136     :config (global-hl-todo-mode 1))
137 #+end_src
138 ** Don't lose cursor
139 #+begin_src emacs-lisp
140   (blink-cursor-mode)
141 #+end_src
142 ** Visual line mode
143 Soft wrap words and do operations by visual lines.
144 #+begin_src emacs-lisp
145   (add-hook 'text-mode-hook 'visual-line-mode 1)
146 #+end_src
147 ** Display number of matches in search
148 #+begin_src emacs-lisp
149   (use-package anzu
150     :config (global-anzu-mode))
151 #+end_src
152 ** Visual bell
153 Inverts modeline instead of audible bell or the standard visual bell.
154 #+begin_src emacs-lisp
155   (setq visible-bell nil
156         ring-bell-function
157         (lambda () (invert-face 'mode-line)
158           (run-with-timer 0.1 nil #'invert-face 'mode-line)))
159 #+end_src
160 * Evil mode
161 ** General
162 #+begin_src emacs-lisp
163   (use-package evil
164     :custom (select-enable-clipboard nil)
165     :config
166     (evil-mode)
167     (fset 'evil-visual-update-x-selection 'ignore) ;; Keep clipboard and register seperate
168     ;; Use visual line motions even outside of visual-line-mode buffers
169     (evil-global-set-key 'motion "j" 'evil-next-visual-line)
170     (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
171     (global-set-key (kbd "<escape>") 'keyboard-escape-quit))
172 #+end_src
173 ** Evil collection
174 #+begin_src emacs-lisp
175   (use-package evil-collection
176     :after evil
177     :init (evil-collection-init)
178     :custom (evil-collection-setup-minibuffer t))
179 #+end_src
180 ** Surround
181 tpope prevails!
182 #+begin_src emacs-lisp
183   (use-package evil-surround
184     :config (global-evil-surround-mode))
185 #+end_src
186 ** Leader key
187 #+begin_src emacs-lisp
188   (use-package evil-leader
189     :straight (evil-leader :type git :host github :repo "cofi/evil-leader")
190     :config
191     (evil-leader/set-leader "<SPC>")
192     (global-evil-leader-mode))
193 #+end_src
194 ** Nerd commenter
195 #+begin_src emacs-lisp
196   ;; Nerd commenter
197   (use-package evil-nerd-commenter
198     :bind (:map evil-normal-state-map
199                 ("gc" . evilnc-comment-or-uncomment-lines))
200     :custom (evilnc-invert-comment-line-by-line nil))
201 #+end_src
202 ** Undo redo
203 Fix the oopsies!
204 #+begin_src emacs-lisp
205   (evil-set-undo-system 'undo-redo)
206 #+end_src
207 ** Number incrementing
208 Add back C-a/C-x
209 #+begin_src emacs-lisp
210   (use-package evil-numbers
211     :straight (evil-numbers :type git :host github :repo "juliapath/evil-numbers")
212     :bind (:map evil-normal-state-map
213                 ("C-M-a" . evil-numbers/inc-at-pt)
214                 ("C-M-x" . evil-numbers/dec-at-pt)))
215 #+end_src
216 ** Evil org
217 *** Init
218 #+begin_src emacs-lisp
219   (use-package evil-org
220     :after org
221     :hook (org-mode . evil-org-mode)
222     :config
223     (evil-org-set-key-theme '(textobjects insert navigation shift todo)))
224   (use-package evil-org-agenda
225     :straight (:type built-in)
226     :after evil-org
227     :config (evil-org-agenda-set-keys))
228 #+end_src
229 *** Leader maps
230 #+begin_src emacs-lisp
231   (evil-leader/set-key-for-mode 'org-mode
232     "T" 'org-show-todo-tree
233     "a" 'org-agenda
234     "c" 'org-archive-subtree)
235 #+end_src
236 * Org mode
237 ** General
238 #+begin_src emacs-lisp
239   (use-package org
240     :straight (:type built-in)
241     :commands (org-capture org-agenda)
242     :custom
243     (org-ellipsis " ▾")
244     (org-agenda-start-with-log-mode t)
245     (org-agenda-files (quote ("~/Org/tasks.org" "~/Org/break.org")))
246     (org-log-done 'time)
247     (org-log-into-drawer t)
248     (org-src-tab-acts-natively t)
249     (org-src-fontify-natively t)
250     (org-startup-indented t)
251     (org-hide-emphasis-markers t)
252     (org-fontify-whole-block-delimiter-line nil)
253     :bind ("C-c a" . org-agenda))
254 #+end_src
255 ** Tempo
256 #+begin_src emacs-lisp
257   (use-package org-tempo
258     :after org
259     :straight (:type built-in)
260     :config
261     ;; TODO: There's gotta be a more efficient way to write this
262     (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
263     (add-to-list 'org-structure-template-alist '("sp" . "src conf :tangle ~/.spectrwm.conf"))
264     (add-to-list 'org-structure-template-alist '("ash" . "src shell :tangle ~/.config/ash/ashrc"))
265     (add-to-list 'org-structure-template-alist '("al" . "src yml :tangle ~/.config/alacritty/alacritty.yml"))
266     (add-to-list 'org-structure-template-alist '("ipy" . "src python :tangle ~/.ipython/"))
267     (add-to-list 'org-structure-template-alist '("pi" . "src conf :tangle ~/.config/picom/picom.conf"))
268     (add-to-list 'org-structure-template-alist '("git" . "src conf :tangle ~/.gitconfig"))
269     (add-to-list 'org-structure-template-alist '("du" . "src conf :tangle ~/.config/dunst/dunstrc"))
270     (add-to-list 'org-structure-template-alist '("za" . "src conf :tangle ~/.config/zathura/zathurarc"))
271     (add-to-list 'org-structure-template-alist '("ff1" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css"))
272     (add-to-list 'org-structure-template-alist '("ff2" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css"))
273     (add-to-list 'org-structure-template-alist '("xr" . "src conf :tangle ~/.Xresources")))
274 #+end_src
275 * Autocompletion
276 ** Ivy
277 Simple, but not too simple autocompletion.
278 #+begin_src emacs-lisp
279   (use-package ivy
280     :bind (("C-s" . swiper)
281            :map ivy-minibuffer-map
282            ("TAB" . ivy-alt-done)
283            :map ivy-switch-buffer-map
284            ("M-d" . ivy-switch-buffer-kill))
285     :config (ivy-mode))
286 #+end_src
287 ** Ivy-rich
288 #+begin_src emacs-lisp
289   (use-package ivy-rich
290     :after (ivy counsel)
291     :config (ivy-rich-mode))
292 #+end_src
293 ** Counsel
294 Ivy everywhere.
295 #+begin_src emacs-lisp
296   (use-package counsel
297     :bind (("C-M-j" . 'counsel-switch-buffer)
298            :map minibuffer-local-map
299            ("C-r" . 'counsel-minibuffer-history))
300     :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
301     :config (counsel-mode))
302 #+end_src
303 ** Remember frequent commands
304 #+begin_src emacs-lisp
305   (use-package ivy-prescient
306     :after counsel
307     :custom
308     (ivy-prescient-enable-filtering nil)
309     :config
310     (prescient-persist-mode)
311     (ivy-prescient-mode))
312 #+end_src
313 ** Swiper
314 Better search utility.
315 #+begin_src emacs-lisp
316   (use-package swiper)
317 #+end_src
318 * EmacsOS
319 ** RSS
320 Use elfeed for RSS. I have another file with all the feeds in it.
321 #+begin_src emacs-lisp
322   (use-package elfeed
323     :bind (("C-c e" . elfeed))
324     :config
325     (load "~/.emacs.d/feeds.el")
326     (add-hook 'elfeed-new-entry-hook
327               (elfeed-make-tagger :feed-url "youtube\\.com"
328                                   :add '(youtube)))
329     :bind (:map elfeed-search-mode-map ("C-c C-o" . 'elfeed-show-visit)))
330
331   (use-package elfeed-goodies
332     :after elfeed
333     :config (elfeed-goodies/setup))
334 #+end_src
335 ** Email
336 Use mu4e for reading emails.
337
338 I use `offlineimap` to sync my maildirs. It is slower than mbsync, but is fast enough for me, especially when ran with the =-q= option.
339
340 Contexts are a not very well known feature of mu4e that makes it super easy to manage multiple accounts. Much better than some of the hacky methods and external packages that I've seen.
341 #+begin_src emacs-lisp
342   (use-package smtpmail
343     :straight (:type built-in))
344   (use-package mu4e
345     :load-path "/usr/share/emacs/site-lisp/mu4e"
346     :straight (:build nil)
347     :bind (("C-c m" . mu4e))
348     :config
349     (setq user-full-name "Armaan Bhojwani"
350           smtpmail-local-domain "armaanb.net"
351           smtpmail-stream-type 'ssl
352           smtpmail-smtp-service '465
353           mu4e-change-filenames-when-moving t
354           mu4e-get-mail-command "offlineimap -q"
355           message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n"
356           message-citation-line-function 'message-insert-formatted-citation-line
357           mu4e-completing-read-function 'ivy-completing-read
358           mu4e-confirm-quit nil
359           mail-user-agent 'mu4e-user-agent
360           mu4e-contexts
361           `( ,(make-mu4e-context
362                :name "school"
363                :enter-func (lambda () (mu4e-message "Entering school context"))
364                :leave-func (lambda () (mu4e-message "Leaving school context"))
365                :match-func (lambda (msg)
366                              (when msg
367                                (string-match-p "^/school" (mu4e-message-field msg :maildir))))
368                :vars '((user-mail-address . "abhojwani22@nobles.edu")
369                        (mu4e-sent-folder . "/school/Sent")
370                        (mu4e-drafts-folder . "/school/Drafts")
371                        (mu4e-trash-folder . "/school/Trash")
372                        (mu4e-refile-folder . "/school/Archive")
373                        (message-cite-reply-position . above)
374                        (user-mail-address . "abhojwani22@nobles.edu")
375                        (smtpmail-smtp-user . "abhojwani22@nobles.edu")
376                        (smtpmail-smtp-server . "smtp.gmail.com")))
377              ,(make-mu4e-context
378                :name "personal"
379                :enter-func (lambda () (mu4e-message "Entering personal context"))
380                :leave-func (lambda () (mu4e-message "Leaving personal context"))
381                :match-func (lambda (msg)
382                              (when msg
383                                (string-match-p "^/personal" (mu4e-message-field msg :maildir))))
384                :vars '((mu4e-sent-folder . "/personal/Sent")
385                        (mu4e-drafts-folder . "/personal/Drafts")
386                        (mu4e-trash-folder . "/personal/Trash")
387                        (mu4e-refile-folder . "/personal/Archive")
388                        (user-mail-address . "me@armaanb.net")
389                        (message-cite-reply-position . below)
390                        (smtpmail-smtp-user . "me@armaanb.net")
391                        (smtpmail-smtp-server . "smtp.mailbox.org")))))
392     (add-to-list 'mu4e-bookmarks
393                  '(:name "Unified inbox"
394                          :query "maildir:\"/personal/INBOX\" or maildir:\"/school/INBOX\""
395                          :key ?b))
396     :hook ((mu4e-compose-mode . flyspell-mode)
397            (mu4e-compose-mode . auto-fill-mode)
398            (mu4e-view-mode-hook . turn-on-visual-line-mode)))
399 #+end_src
400 ** Default browser
401 Set EWW as default browser except for videos.
402 #+begin_src emacs-lisp
403   (defun browse-url-mpv (url &optional new-window)
404     "Open URL in MPV."
405     (start-process "mpv" "*mpv*" "mpv" url))
406
407   (setq browse-url-handlers
408         (quote
409          (("youtu\\.?be" . browse-url-mpv)
410           ("peertube.*" . browse-url-mpv)
411           ("vid.*" . browse-url-mpv)
412           ("vid.*" . browse-url-mpv)
413           ("." . eww-browse-url)
414           )))
415 #+end_src
416 ** EWW
417 Some EWW enhancements.
418 *** Give buffer a useful name
419 #+begin_src emacs-lisp
420   ;; From https://protesilaos.com/dotemacs/
421   (defun prot-eww--rename-buffer ()
422     "Rename EWW buffer using page title or URL.
423         To be used by `eww-after-render-hook'."
424     (let ((name (if (eq "" (plist-get eww-data :title))
425                     (plist-get eww-data :url)
426                   (plist-get eww-data :title))))
427       (rename-buffer (format "*%s # eww*" name) t)))
428
429   (use-package eww
430     :straight (:type built-in)
431     :bind (("C-c w" . eww))
432     :hook (eww-after-render-hook prot-eww--rename-buffer))
433 #+end_src
434 *** Better entrypoint
435 #+begin_src emacs-lisp
436   ;; From https://protesilaos.com/dotemacs/
437   (defun prot-eww-browse-dwim (url &optional arg)
438     "Visit a URL, maybe from `eww-prompt-history', with completion.
439
440   With optional prefix ARG (\\[universal-argument]) open URL in a
441   new eww buffer.
442
443   If URL does not look like a valid link, run a web query using
444   `eww-search-prefix'.
445
446   When called from an eww buffer, provide the current link as
447   initial input."
448     (interactive
449      (list
450       (completing-read "Query:" eww-prompt-history
451                        nil nil (plist-get eww-data :url) 'eww-prompt-history)
452       current-prefix-arg))
453     (eww url (if arg 4 nil)))
454
455   (global-set-key (kbd "C-c w") 'prot-eww-browse-dwim)
456 #+end_src
457 ** IRC
458 #+begin_src emacs-lisp
459   (use-package erc
460     :straight (:type built-in)
461     :config
462     (load "~/.emacs.d/irc.el")
463     (acheam-irc)
464     (erc-notifications-enable)
465     (erc-smiley-disable))
466
467   (use-package erc-hl-nicks
468     :config (erc-hl-nicks-mode 1))
469 #+end_src
470 ** Emacs Anywhere
471 Use Emacs globally. Use the Emacs daemon and bind a key in your wm to =emacsclient --eval "(emacs-everywhere)"=.
472 #+begin_src emacs-lisp
473   (use-package emacs-everywhere)
474 #+end_src
475 * Emacs IDE
476 ** Code cleanup
477 #+begin_src emacs-lisp
478   (use-package blacken
479     :hook (python-mode . blacken-mode)
480     :config (setq blacken-line-length 79))
481
482   ;; Purge whitespace
483   (use-package ws-butler
484     :config (ws-butler-global-mode))
485 #+end_src
486 ** Flycheck
487 #+begin_src emacs-lisp
488   (use-package flycheck
489     :config (global-flycheck-mode))
490 #+end_src
491 ** Project management
492 #+begin_src emacs-lisp
493   (use-package projectile
494     :config (projectile-mode)
495     :custom ((projectile-completion-system 'ivy))
496     :bind-keymap
497     ("C-c p" . projectile-command-map)
498     :init
499     (when (file-directory-p "~/Code")
500       (setq projectile-project-search-path '("~/Code")))
501     (setq projectile-switch-project-action #'projectile-dired))
502
503   (use-package counsel-projectile
504     :after projectile
505     :config (counsel-projectile-mode))
506 #+end_src
507 ** Dired
508 #+begin_src emacs-lisp
509   (use-package dired
510     :straight (:type built-in)
511     :commands (dired dired-jump)
512     :custom ((dired-listing-switches "-agho --group-directories-first"))
513     :config (evil-collection-define-key 'normal 'dired-mode-map
514               "h" 'dired-single-up-directory
515               "l" 'dired-single-buffer))
516
517   (use-package dired-single
518     :commands (dired dired-jump))
519
520   (use-package dired-open
521     :commands (dired dired-jump)
522     :custom (dired-open-extensions '(("png" . "feh")
523                                      ("mkv" . "mpv"))))
524
525   (use-package dired-hide-dotfiles
526     :hook (dired-mode . dired-hide-dotfiles-mode)
527     :config
528     (evil-collection-define-key 'normal 'dired-mode-map
529       "H" 'dired-hide-dotfiles-mode))
530 #+end_src
531 ** Git
532 *** Magit
533 # TODO: Write a command that commits hunk, skipping staging step.
534 #+begin_src emacs-lisp
535   (use-package magit)
536 #+end_src
537 *** Colored diff in line number area
538 #+begin_src emacs-lisp
539   (use-package diff-hl
540     :straight (diff-hl :type git :host github :repo "dgutov/diff-hl")
541     :hook ((magit-pre-refresh-hook . diff-hl-magit-pre-refresh)
542            (magit-post-refresh-hook . diff-hl-magit-post-refresh))
543     :config (global-diff-hl-mode))
544 #+end_src
545 * General text editing
546 ** Indentation
547 Indent after every change.
548 #+begin_src emacs-lisp
549   (use-package aggressive-indent
550     :config (global-aggressive-indent-mode))
551 #+end_src
552 ** Spell checking
553 Spell check in text mode, and in prog-mode comments.
554 #+begin_src emacs-lisp
555   (dolist (hook '(text-mode-hook))
556     (add-hook hook (lambda () (flyspell-mode))))
557   (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
558     (add-hook hook (lambda () (flyspell-mode -1))))
559   (add-hook 'prog-mode (lambda () (flyspell-prog mode)))
560 #+end_src
561 ** Expand tabs to spaces
562 #+begin_src emacs-lisp
563   (setq-default tab-width 2)
564 #+end_src
565 ** Copy kill ring to clipboard
566 #+begin_src emacs-lisp
567   (setq x-select-enable-clipboard t)
568   (defun copy-kill-ring-to-xorg ()
569     "Copy the current kill ring to the xorg clipboard."
570     (interactive)
571     (x-select-text (current-kill 0)))
572 #+end_src
573 ** Save place
574 Opens file where you left it.
575 #+begin_src emacs-lisp
576   (save-place-mode)
577 #+end_src
578 ** Writing mode
579 Distraction free writing a la junegunn/goyo.
580 #+begin_src emacs-lisp
581   (use-package olivetti
582     :config
583     (evil-leader/set-key "o" 'olivetti-mode))
584 #+end_src
585 ** Abbreviations
586 Abbreviate things!
587 #+begin_src emacs-lisp
588   (setq abbrev-file-name "~/.emacs.d/abbrevs.el")
589   (setq save-abbrevs 'silent)
590   (setq-default abbrev-mode t)
591 #+end_src
592 ** TRAMP
593 #+begin_src emacs-lisp
594   (setq tramp-default-method "ssh")
595 #+end_src
596 ** Don't ask about following symlinks in vc
597 #+begin_src emacs-lisp
598   (setq vc-follow-symlinks t)
599 #+end_src
600 ** Don't ask to save custom dictionary
601 #+begin_src emacs-lisp
602   (setq ispell-silently-savep t)
603 #+end_src
604 * Keybindings
605 ** Switch windows
606 #+begin_src emacs-lisp
607   (use-package ace-window
608     :bind ("M-o" . ace-window))
609 #+end_src
610 ** Kill current buffer
611 Makes "C-x k" binding faster.
612 #+begin_src emacs-lisp
613   (substitute-key-definition 'kill-buffer 'kill-buffer-and-window global-map)
614 #+end_src
615 * Other settings
616 ** OpenSCAD
617 #+begin_src emacs-lisp
618   (use-package scad-mode)
619 #+end_src
620 ** Control backup files
621 Stop backup files from spewing everywhere.
622 #+begin_src emacs-lisp
623   (setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
624 #+end_src
625 ** Make yes/no easier
626 #+begin_src emacs-lisp
627   (defalias 'yes-or-no-p 'y-or-n-p)
628 #+end_src
629 ** Move customize file
630 No more clogging up init.el.
631 #+begin_src emacs-lisp
632   (setq custom-file "~/.emacs.d/custom.el")
633   (load custom-file)
634 #+end_src
635 ** Better help
636 #+begin_src emacs-lisp
637   (use-package helpful
638     :commands (helpful-callable helpful-variable helpful-command helpful-key)
639     :custom
640     (counsel-describe-function-function #'helpful-callable)
641     (counsel-describe-variable-function #'helpful-variable)
642     :bind
643     ([remap describe-function] . counsel-describe-function)
644     ([remap describe-command] . helpful-command)
645     ([remap describe-variable] . counsel-describe-variable)
646     ([remap describe-key] . helpful-key))
647 #+end_src
648 ** GPG
649 #+begin_src emacs-lisp
650   (use-package epa-file
651     :straight (:type built-in)
652     :custom
653     (epa-file-select-keys nil)
654     (epa-file-encrypt-to '("me@armaanb.net"))
655     (password-cache-expiry (* 60 15)))
656
657   (use-package pinentry
658     :config (pinentry-start))
659 #+end_src
660 ** Pastebin
661 #+begin_src emacs-lisp
662   (use-package 0x0
663     :straight (0x0 :type git :repo "https://git.sr.ht/~zge/nullpointer-emacs")
664     :custom (0x0-default-service 'envs)
665     :config (evil-leader/set-key
666               "00" '0x0-upload
667               "0f" '0x0-upload-file
668               "0s" '0x0-upload-string
669               "0c" '0x0-upload-kill-ring
670               "0p" '0x0-upload-popup))
671 #+end_src
672 * Tangles
673 ** Spectrwm
674 *** General settings
675 #+begin_src conf :tangle ~/.spectrwm.conf
676   workspace_limit = 5
677   warp_pointer = 1
678   modkey = Mod4
679   autorun = ws[1]:/home/armaa/Code/scripts/autostart
680 #+end_src
681 *** Bar
682 #+begin_src conf :tangle ~/.spectrwm.conf
683   bar_enabled = 0
684   bar_font = xos4 Fira Code:pixelsize=14:antialias=true # any installed font
685 #+end_src
686 *** Keybindings
687 **** WM actions
688 #+begin_src conf :tangle ~/.spectrwm.conf
689   program[term] = alacritty
690   program[screenshot_all] = flameshot gui
691   program[notif] = /home/armaa/Code/scripts/setter status
692   program[pass] = /home/armaa/Code/scripts/passmenu
693
694   bind[notif] = MOD+n
695   bind[pass] = MOD+Shift+p
696 #+end_src
697 **** Media keys
698 #+begin_src conf :tangle ~/.spectrwm.conf
699   program[paup] = /home/armaa/Code/scripts/setter audio +5
700   program[padown] = /home/armaa/Code/scripts/setter audio -5
701   program[pamute] = /home/armaa/Code/scripts/setter audio
702   program[brigup] = /home/armaa/Code/scripts/setter brightness +10%
703   program[brigdown] = /home/armaa/Code/scripts/setter brightness 10%-
704   program[next] = playerctl next
705   program[prev] = playerctl previous
706   program[pause] = playerctl play-pause
707
708   bind[padown] = XF86AudioLowerVolume
709   bind[paup] = XF86AudioRaiseVolume
710   bind[pamute] = XF86AudioMute
711   bind[brigdown] = XF86MonBrightnessDown
712   bind[brigup] = XF86MonBrightnessUp
713   bind[pause] = XF86AudioPlay
714   bind[next] = XF86AudioNext
715   bind[prev] = XF86AudioPrev
716 #+end_src
717 **** HJKL
718 #+begin_src conf :tangle ~/.spectrwm.conf
719   program[h] = xdotool keyup h key --clearmodifiers Left
720   program[j] = xdotool keyup j key --clearmodifiers Down
721   program[k] = xdotool keyup k key --clearmodifiers Up
722   program[l] = xdotool keyup l key --clearmodifiers Right
723
724   bind[h] = MOD + Control + h
725   bind[j] = MOD + Control + j
726   bind[k] = MOD + Control + k
727   bind[l] = MOD + Control + l
728 #+end_src
729 **** Programs
730 #+begin_src conf :tangle ~/.spectrwm.conf
731   program[aerc] = alacritty -e aerc
732   program[catgirl] = alacritty --hold -e sh -c "while : ; do ssh root@armaanb.net -t abduco -A irc catgirl freenode; sleep 2; done"
733   program[emacs] = emacsclient -c
734   program[firefox] = firefox
735   program[calc] = alacritty -e because -l
736   program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
737
738   bind[aerc] = MOD+Control+1
739   bind[catgirl] = MOD+Control+2
740   bind[firefox] = MOD+Control+3
741   bind[emacs-anywhere] = MOD+Control+4
742   bind[calc] = MOD+Control+5
743   bind[emacs] = MOD+Control+Return
744 #+end_src
745 **** Quirks
746 #+begin_src conf :tangle ~/.spectrwm.conf
747   quirk[Castle Menu] = FLOAT
748   quirk[momen] = FLOAT
749 #+end_src
750 ** Ash
751 *** Options
752 #+begin_src conf :tangle ~/.config/ash/ashrc
753   set -o vi
754 #+end_src
755 *** Functions
756 **** Update all packages
757 #+begin_src shell :tangle ~/.config/ash/ashrc
758   color=$(tput setaf 5)
759   reset=$(tput sgr0)
760
761   apu() {
762       sudo echo "${color}== upgrading with yay ==${reset}"
763       yay
764       echo ""
765       echo "${color}== checking for pacnew files ==${reset}"
766       sudo pacdiff
767       echo
768       echo "${color}== upgrading flatpaks ==${reset}"
769       flatpak update
770       echo ""
771       echo "${color}== upgrading zsh plugins ==${reset}"
772       zpe-pull
773       echo ""
774       echo "${color}== updating nvim plugins ==${reset}"
775       nvim +PlugUpdate +PlugUpgrade +qall
776       echo "Updated nvim plugins"
777       echo ""
778       echo "${color}You are entirely up to date!${reset}"
779   }
780 #+end_src
781 **** Clean all packages
782 #+begin_src shell :tangle ~/.config/ash/ashrc
783   apap() {
784       sudo echo "${color}== cleaning pacman orphans ==${reset}"
785       (pacman -Qtdq | sudo pacman -Rns - 2> /dev/null) || echo "No orphans"
786       echo ""
787       echo "${color}== cleaning flatpaks ==${reset}"
788       flatpak remove --unused
789       echo ""
790       echo "${color}== cleaning zsh plugins ==${reset}"
791       zpe-clean
792       echo ""
793       echo "${color}== cleaning nvim plugins ==${reset}"
794       nvim +PlugClean +qall
795       echo "Cleaned nvim plugins"
796       echo ""
797       echo "${color}All orphans cleaned!${reset}"
798   }
799 #+end_src
800 **** Interact with 0x0
801 #+begin_src shell :tangle ~/.config/ash/ashrc
802   zxz="https://envs.sh"
803   ufile() { curl -F"file=@$1" "$zxz" ; }
804   upb() { curl -F"file=@-;" "$zxz" ; }
805   uurl() { curl -F"url=$1" "$zxz" ; }
806   ushort() { curl -F"shorten=$1" "$zxz" ; }
807   uclip() { xclip -out | curl -F"file=@-;" "$zxz" ; }
808 #+end_src
809 **** Finger
810 #+begin_src shell :tangle ~/.config/ash/ashrc
811   finger() {
812       user=$(echo "$1" | cut -f 1 -d '@')
813       host=$(echo "$1" | cut -f 2 -d '@')
814       echo $user | nc "$host" 79 -N
815   }
816 #+end_src
817 **** Upload to ftp.armaanb.net
818 #+begin_src shell :tangle ~/.config/ash/ashrc
819   pubup() {
820       rsync "$1" "root@armaanb.net:/var/ftp/pub/${2}"
821       echo "https://ftp.armaanb.net/pub/"$(basename "$1") | tee /dev/tty | xclip -sel c
822   }
823 #+end_src
824 *** Aliases
825 **** SSH
826 #+begin_src shell :tangle ~/.config/ash/ashrc
827   alias bhoji-drop='ssh -p 23 root@armaanb.net'
828   alias irc='ssh root@armaanb.net -t abduco -A irc catgirl freenode'
829   alias union='ssh 192.168.1.18'
830   alias mine='ssh -p 23 root@pickupserver.cc'
831   alias tcf='ssh root@204.48.23.68'
832   alias ngmun='ssh root@157.245.89.25'
833   alias prox='ssh root@192.168.1.224'
834   alias ncq='ssh root@143.198.123.17'
835   alias envs='ssh acheam@envs.net'
836 #+end_src
837 **** File management
838 #+begin_src shell :tangle ~/.config/ash/ashrc
839   alias ls='exa -lh --icons --git --group-directories-first'
840   alias la='exa -lha --icons --git --group-directories-first'
841   alias df='df -h / /boot'
842   alias du='du -h'
843   alias free='free -h'
844   alias cp='cp -riv'
845   alias rm='rm -iv'
846   alias mv='mv -iv'
847   alias ln='ln -iv'
848   alias grep='grep -in --exclude-dir=.git --color=auto'
849   alias fname='find -name'
850   alias mkdir='mkdir -pv'
851   alias unar='atool -x'
852   alias wget='wget -e robots=off'
853   alias lanex='~/.local/share/lxc/lxc'
854   alias vim='nvim'
855 #+end_src
856 **** System management
857 #+begin_src shell :tangle ~/.config/ash/ashrc
858   alias jctl='journalctl -p 3 -xb'
859   alias pkill='pkill -i'
860   alias cx='chmod +x'
861   alias redoas='doas $(fc -ln -1)'
862   alias crontab='crontab-argh'
863   alias sudo='doas ' # allows aliases to be run with doas
864   alias pasu='git -C ~/.password-store push'
865   alias yadu='yadm add -u && yadm commit -m "Updated `date -Iseconds`" && \
866     yadm push'
867 #+end_src
868 **** Networking
869 #+begin_src shell :tangle ~/.config/ash/ashrc
870   alias ping='ping -c 10'
871   alias speed='speedtest-cli'
872   alias ip='ip --color=auto'
873   alias cip='curl https://armaanb.net/ip'
874   alias gps='gpg --keyserver keyserver.ubuntu.com --search-keys'
875   alias gpp='gpg --keyserver keyserver.ubuntu.com --recv-key'
876   alias plan='T=$(mktemp) && \
877         rsync root@armaanb.net:/etc/finger/plan.txt "$T" && \
878         TT=$(mktemp) && \
879         head -n -2 $T > $TT && \
880         vim $TT && \
881         echo "\nLast updated: $(date -R)" >> "$TT" && \
882         fold -sw 72 "$TT" > "$T"| \
883         rsync "$T" root@armaanb.net:/etc/finger/plan.txt'
884   alias wttr='curl -s "wttr.in/02445?n" | head -n -3'
885 #+end_src
886 **** Other
887 #+begin_src shell :tangle ~/.config/ash/ashrc
888   alias bigrandomfile='dd if=/dev/urandom of=1GB-urandom bs=1M count=1024 \
889     iflag=fullblock status=progress'
890   alias bigboringfile='dd if=/dev/zero of=1GB-zero bs=1M count=1024 \
891     iflag=fullblock status=progress'
892   alias ts='gen-shell -c task'
893   alias ts='gen-shell -c task'
894   alias tetris='autoload -Uz tetriscurses && tetriscurses'
895   alias news='newsboat'
896   alias tilderadio="\mpv https://radio.tildeverse.org/radio/8000/radio.ogg"
897   alias ytmusic="youtube-dl -x --add-metadata  --audio-format aac \
898     --restrict-filenames -o '%(title)s.%(ext)s'"
899   alias cal="cal -3 --color=auto"
900   alias bc='bc -l'
901 #+end_src
902 **** Virtual machines, chroots
903 #+begin_src shell :tangle ~/.config/ash/ashrc
904   alias ckiss="sudo chrooter ~/Virtual/kiss"
905   alias cdebian="sudo chrooter ~/Virtual/debian bash"
906   alias cwindows='devour qemu-system-x86_64 \
907     -smp 3 \
908     -cpu host \
909     -enable-kvm \
910     -m 3G \
911     -device VGA,vgamem_mb=64 \
912     -device intel-hda \
913     -device hda-duplex \
914     -net nic \
915     -net user,smb=/home/armaa/Public \
916     -drive format=qcow2,file=/home/armaa/Virtual/windows.qcow2'
917 #+end_src
918 **** Python
919 #+begin_src shell :tangle ~/.config/ash/ashrc
920   alias ipy="ipython"
921   alias zpy="zconda && ipython"
922   alias math="ipython --profile=math"
923   alias pypi="python setup.py sdist && twine upload dist/*"
924   alias pip="python -m pip"
925   alias black="black -l 79"
926 #+end_src
927 **** Latin
928 #+begin_src shell :tangle ~/.config/ash/ashrc
929   alias words='gen-shell -c "words"'
930   alias words-e='gen-shell -c "words ~E"'
931 #+end_src
932 **** Devour
933 #+begin_src shell :tangle ~/.config/ash/ashrc
934   alias zathura='devour zathura'
935   alias mpv='devour mpv'
936   alias sql='devour sqlitebrowser'
937   alias cad='devour openscad'
938   alias feh='devour feh'
939 #+end_src
940 **** Package management (Pacman)
941 #+begin_src shell :tangle ~/.config/ash/ashrc
942   alias aps='yay -Ss'
943   alias api='yay -Syu'
944   alias apii='sudo pacman -S'
945   alias app='yay -Rns'
946   alias apc='yay -Sc'
947   alias apo='yay -Qttd'
948   alias azf='pacman -Q | fzf'
949   alias favorites='pacman -Qe | cut -d " " -f 1 > ~/Documents/favorites'
950   alias ufetch='ufetch-arch'
951   alias reflect='reflector --verbose --sort rate --save \
952      ~/.local/etc/pacman.d/mirrorlist --download-timeout 60' # Takes ~45m to run
953 #+end_src
954 **** Package management (KISS)
955 #+begin_src shell :tangle ~/.config/ash/ashrc
956   alias kzf="kiss s \* | xargs -l basename | \
957     fzf --preview 'kiss search {} | xargs -l dirname'"
958 #+end_src
959 *** Exports
960 #+begin_src shell :tangle ~/.config/ash/ashrc
961   export EDITOR="emacsclient -c"
962   export VISUAL="$EDITOR"
963   export TERM=xterm-256color # for compatability
964
965   export GPG_TTY="$(tty)"
966   export MANPAGER='nvim +Man!'
967   export PAGER='less'
968
969   export GTK_USE_PORTAL=1
970
971   export PATH="/home/armaa/.local/bin:$PATH" # prioritize .local/bin
972   export PATH="/home/armaa/Code/scripts:$PATH" # prioritize my scripts
973   export PATH="/home/armaa/Code/scripts/bin:$PATH" # prioritize my bins
974   export PATH="$PATH:/home/armaa/.cargo/bin"
975   export PATH="$PATH:/home/armaa/.local/share/gem/ruby/2.7.0/bin"
976   export PATH="$PATH:/usr/sbin"
977   export PATH="$PATH:/opt/FreeTube/freetube"
978
979   export LC_ALL="en_US.UTF-8"
980   export LC_CTYPE="en_US.UTF-8"
981   export LANGUAGE="en_US.UTF-8"
982
983   export KISS_PATH="/home/armaa/Virtual/kiss/home/armaa/kiss-repo"
984   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/core"
985   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/extra"
986   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/xorg"
987   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-main/testing"
988   export KISS_PATH="$KISS_PATH:/home/armaa/Clone/repo-community/community"
989 #+end_src
990 ** Alacritty
991 *** Appearance
992 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
993 font:
994   normal:
995     family: JetBrains Mono Nerd Font
996     style: Medium
997   italic:
998     style: Italic
999   Bold:
1000     style: Bold
1001   size: 7
1002   ligatures: true # Requires ligature patch
1003
1004 window:
1005   padding:
1006     x: 5
1007     y: 5
1008
1009 background_opacity: 1
1010 #+end_src
1011 *** Color scheme
1012 Modus vivendi. Source: https://github.com/ishan9299/Nixos/blob/d4bbb7536be95b59466bb9cca4d671be46e04e81/user/alacritty/alacritty.yml#L30-L118
1013 #+begin_src yml :tangle ~/.config/alacritty/alacritty.yml
1014 colors:
1015   # Default colors
1016   primary:
1017     background: '#000000'
1018     foreground: '#ffffff'
1019
1020   cursor:
1021     text: '#000000'
1022     background: '#ffffff'
1023
1024   # Normal colors (except green it is from intense colors)
1025   normal:
1026     black:   '#000000'
1027     red:     '#ff8059'
1028     green:   '#00fc50'
1029     yellow:  '#eecc00'
1030     blue:    '#29aeff'
1031     magenta: '#feacd0'
1032     cyan:    '#00d3d0'
1033     white:   '#eeeeee'
1034
1035   # Bright colors [all the faint colors in the modus theme]
1036   bright:
1037     black:   '#555555'
1038     red:     '#ffa0a0'
1039     green:   '#88cf88'
1040     yellow:  '#d2b580'
1041     blue:    '#92baff'
1042     magenta: '#e0b2d6'
1043     cyan:    '#a0bfdf'
1044     white:   '#ffffff'
1045
1046   # dim [all the intense colors in modus theme]
1047   dim:
1048     black:   '#222222'
1049     red:     '#fb6859'
1050     green:   '#00fc50'
1051     yellow:  '#ffdd00'
1052     blue:    '#00a2ff'
1053     magenta: '#ff8bd4'
1054     cyan:    '#30ffc0'
1055     white:   '#dddddd'
1056 #+end_src
1057 ** IPython
1058 *** General
1059 Symlink profile_default/ipython_config.py to profile_math/ipython_config.py
1060 #+begin_src python :tangle ~/.ipython/profile_default/ipython_config.py
1061   c.TerminalInteractiveShell.editing_mode = 'vi'
1062   c.InteractiveShell.colors = 'linux'
1063   c.TerminalInteractiveShell.confirm_exit = False
1064 #+end_src
1065 *** Math
1066 #+begin_src python :tangle ~/.ipython/profile_math/startup.py
1067   from math import *
1068
1069   def deg(x):
1070       return x * (180 /  pi)
1071
1072   def rad(x):
1073       return x * (pi / 180)
1074
1075   def rad(x, unit):
1076       return (x * (pi / 180)) / unit
1077
1078   def csc(x):
1079       return 1 / sin(x)
1080
1081   def sec(x):
1082       return 1 / cos(x)
1083
1084   def cot(x):
1085       return 1 / tan(x)
1086 #+end_src
1087 ** MPV
1088 Make MPV play a little bit smoother.
1089 #+begin_src conf :tangle ~/.config/mpv/mpv.conf
1090   ytdl-format="bestvideo[height<=?1080]+bestaudio/best"
1091   hwdec=auto-copy
1092 #+end_src
1093 ** Inputrc
1094 For any GNU Readline programs
1095 #+begin_src conf :tangle ~/.inputrc
1096   set editing-mode emacs
1097 #+end_src
1098 ** Git
1099 *** User
1100 #+begin_src conf :tangle ~/.gitconfig
1101   [user]
1102   name = Armaan Bhojwani
1103   email = me@armaanb.net
1104   signingkey = 0FEB9471E19C49C60CFBEB133C9ED82FFE788E4A
1105 #+end_src
1106 *** Init
1107 #+begin_src conf :tangle ~/.gitconfig
1108   [init]
1109   defaultBranch = main
1110 #+end_src
1111 *** GPG
1112 #+begin_src conf :tangle ~/.gitconfig
1113   [gpg]
1114   program = gpg
1115 #+end_src
1116 *** Sendemail
1117 #+begin_src conf :tangle ~/.gitconfig
1118   [sendemail]
1119   smtpserver = smtp.mailbox.org
1120   smtpuser = me@armaanb.net
1121   smtpencryption = ssl
1122   smtpserverport = 465
1123   confirm = auto
1124 #+end_src
1125 *** Submodules
1126 #+begin_src conf :tangle ~/.gitconfig
1127   [submodule]
1128   recurse = true
1129 #+end_src
1130 *** Aliases
1131 #+begin_src conf :tangle ~/.gitconfig
1132   [alias]
1133   stat = diff --stat
1134   sclone = clone --depth 1
1135   sclean = clean -dfX
1136   a = add
1137   aa = add .
1138   c = commit
1139   quickfix = commit . --amend --no-edit
1140   p = push
1141   subup = submodule update --remote
1142   loc = diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904 # Empty hash
1143   pushnc = push -o skip-ci
1144 #+end_src
1145 *** Commits
1146 #+begin_src conf :tangle ~/.gitconfig
1147   [commit]
1148   gpgsign = true
1149   verbose = true
1150 #+end_src
1151 ** Dunst
1152 Lightweight notification daemon.
1153 *** General
1154 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1155   [global]
1156   font = "JetBrains Mono Medium Nerd Font 11"
1157   allow_markup = yes
1158   format = "<b>%s</b>\n%b"
1159   sort = no
1160   indicate_hidden = yes
1161   alignment = center
1162   bounce_freq = 0
1163   show_age_threshold = 60
1164   word_wrap = yes
1165   ignore_newline = no
1166   geometry = "400x5-10+10"
1167   transparency = 0
1168   idle_threshold = 120
1169   monitor = 0
1170   sticky_history = yes
1171   line_height = 0
1172   separator_height = 1
1173   padding = 8
1174   horizontal_padding = 8
1175   max_icon_size = 32
1176   separator_color = "#ffffff"
1177   startup_notification = false
1178 #+end_src
1179 *** Modes
1180 #+begin_src conf :tangle ~/.config/dunst/dunstrc
1181   [frame]
1182   width = 1
1183   color = "#ffffff"
1184
1185   [shortcuts]
1186   close = mod4+c
1187   close_all = mod4+shift+c
1188   history = mod4+ctrl+c
1189
1190   [urgency_low]
1191   background = "#222222"
1192   foreground = "#ffffff"
1193   highlight = "#ffffff"
1194   timeout = 5
1195
1196   [urgency_normal]
1197   background = "#222222"
1198   foreground = "#ffffff"
1199   highlight = "#ffffff"
1200   timeout = 15
1201
1202   [urgency_critical]
1203   background = "#222222"
1204   foreground = "#a60000"
1205   highlight = "#ffffff"
1206   timeout = 0
1207 #+end_src
1208 ** Zathura
1209 *** Options
1210 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1211   map <C-i> recolor
1212   map <A-b> toggle_statusbar
1213   set selection-clipboard clipboard
1214   set scroll-step 200
1215
1216   set window-title-basename "true"
1217   set selection-clipboard "clipboard"
1218 #+end_src
1219 *** Colors
1220 #+begin_src conf :tangle ~/.config/zathura/zathurarc
1221   set default-bg         "#000000"
1222   set default-fg         "#ffffff"
1223   set render-loading     true
1224   set render-loading-bg  "#000000"
1225   set render-loading-fg  "#ffffff"
1226
1227   set recolor-lightcolor "#000000" # bg
1228   set recolor-darkcolor  "#ffffff" # fg
1229   set recolor            "true"
1230 #+end_src
1231 ** Firefox
1232 *** Swap tab and URL bars
1233 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1234   #nav-bar {
1235       -moz-box-ordinal-group: 1 !important;
1236   }
1237
1238   #PersonalToolbar {
1239       -moz-box-ordinal-group: 2 !important;
1240   }
1241
1242   #titlebar {
1243       -moz-box-ordinal-group: 3 !important;
1244   }
1245 #+end_src
1246 *** Hide URL bar when not focused.
1247 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1248   #navigator-toolbox:not(:focus-within):not(:hover) {
1249       margin-top: -30px;
1250   }
1251
1252   #navigator-toolbox {
1253       transition: 0.1s margin-top ease-out;
1254   }
1255 #+end_src
1256 ** Black screen by default
1257 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css
1258   #main-window,
1259   #browser,
1260   #browser vbox#appcontent tabbrowser,
1261   #content,
1262   #tabbrowser-tabpanels,
1263   #tabbrowser-tabbox,
1264   browser[type="content-primary"],
1265   browser[type="content"] > html,
1266   .browserContainer {
1267       background: black !important;
1268       color: #fff !important;
1269   }
1270 #+end_src
1271 #+begin_src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css
1272   @-moz-document url("about:home"), url("about:blank"), url("about:newtab") {
1273       body {
1274           background: black !important;
1275       }
1276   }
1277 #+end_src
1278 ** Xresources
1279 *** Color scheme
1280 Modus operandi.
1281 #+begin_src conf :tangle ~/.Xresources
1282   ! special
1283   ,*.foreground:   #ffffff
1284   ,*.background:   #000000
1285   ,*.cursorColor:  #ffffff
1286
1287   ! black
1288   ,*.color0:       #000000
1289   ,*.color8:       #555555
1290
1291   ! red
1292   ,*.color1:       #ff8059
1293   ,*.color9:       #ffa0a0
1294
1295   ! green
1296   ,*.color2:       #00fc50
1297   ,*.color10:      #88cf88
1298
1299   ! yellow
1300   ,*.color3:       #eecc00
1301   ,*.color11:      #d2b580
1302
1303   ! blue
1304   ,*.color4:       #29aeff
1305   ,*.color12:      #92baff
1306
1307   ! magenta
1308   ,*.color5:       #feacd0
1309   ,*.color13:      #e0b2d6
1310
1311   ! cyan
1312   ,*.color6:       #00d3d0
1313   ,*.color14:      #a0bfdf
1314
1315   ! white
1316   ,*.color7:       #eeeeee
1317   ,*.color15:      #dddddd
1318 #+end_src
1319 *** Copy paste
1320 #+begin_src conf :tangle ~/.Xresources
1321   xterm*VT100.Translations: #override \
1322   Shift <KeyPress> Insert: insert-selection(CLIPBOARD) \n\
1323   Ctrl Shift <Key>V:    insert-selection(CLIPBOARD) \n\
1324   Ctrl Shift <Key>C:    copy-selection(CLIPBOARD) \n\
1325   Ctrl <Btn1Up>: exec-formatted("xdg-open '%t'", PRIMARY)
1326 #+end_src
1327 *** Blink cursor
1328 #+begin_src conf :tangle ~/.Xresources
1329   xterm*cursorBlink: true
1330 #+end_src
1331 *** Alt keys
1332 #+begin_src conf :tangle ~/.Xresources
1333   XTerm*eightBitInput:   false
1334   XTerm*eightBitOutput:  true
1335 #+end_src