Files
opalfiles/Desktop.org
2021-12-20 14:28:28 -08:00

4.8 KiB

Desktop Configuration

This .org document is where I store all of my user-level application configuration including shells, terminal emulators, browsers etc.

I prefer to use programs that I can extend the functionality of via configuration files and source code.

Nyxt

Nyxt is a browser written in Common Lisp that follows the same philosophy of extensibility as Emacs. This makes it a perfect companion to an Emacs centered eco-system when you need a browser with more features than Eww.

;; Set default modes when opening Nyxt.
(define-configuration buffer
  ((default-modes (append '(dark-mode
                            vi-normal-mode) %slot-default%))))

;; Keybindings
;; (Note: Override Map will override any other custom keybindings so use a prefix key.)
(define-configuration buffer
  ((override-map (define-key %slot-default%
                   "C-x s" 'nyxt/web-mode:search-buffers
                   "C-x d" 'delete-current-buffer))))

;; todo: Redirect reddit to teddit
;; (defun old-reddit-handler (request-data)
;;   (let ((url (url request-data)))
;;     (setf (url request-data)
;;           (if (search "reddit.com" (quri:uri-host url))
;;               (progn
;;                 (setf (quri:uri-host url) "old.reddit.com")
;;                 (log:info "Switching to old Reddit: ~s" (render-url url))
;;                 url)
;;               url)))
;;   request-data)

;; (define-configuration web-buffer
;;   ((request-resource-hook
;;     (hooks:add-hook %slot-default% (make-handler-resource #'old-reddit-handler)))))
;; (See url-dispatching-handler for a simpler way to achieve the same result.)

Shell

Aside from using e-shell for quick command line usage, I mainly use vterm with Zsh. It's a bit of a complicated setup but allows for the maximum number of files possible to live in .config instead of littering my home directory.

zshrc

[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return

# --- zsh config --- #
export ZSH="$XDG_CONFIG_HOME/oh-my-zsh"
HISTFILE=$XDG_CONFIG_HOME/zsh/.history
ZSH_THEME="mrtazz"
DISABLE_AUTO_UPDATE="true"
ENABLE_CORRECTION="true"
plugins=(git)
# This has to stay below plugins.
source $ZSH/oh-my-zsh.sh

# --- user paths --- #
# scripts
export PATH=/home/ry/scripts:$PATH
# cron scripts
export PATH=/home/ry/scripts/cron-scripts:$PATH
# doom
export PATH=~/.config/emacs/bin:$PATH
# GNU Guix path
export PATH=/home/ry/.guix-profile/bin:$PATH
# --- locale --- #
export LANG=en_US.UTF-8

# --- autostart --- #
pfetch

# --- Functions --- #
# Move files to trash folder instead.
del () { mv "$@" $HOME/.local/share/Trash/files/.; }
# Make directory and CD into it.
mkcd () { mkdir -p -- "$1" && cd -P -- "$1" }

# --- Aliases --- #
# dnf
alias install="sudo dnf -y install"
alias remove="sudo dnf remove"
alias search="dnf search"
alias update="sudo dnf update"

# qol
alias vi="nvim"
alias vim="nvim"
alias unmount="umount"

# systemD
alias sr="sudo systemctl restart"
alias se="sudo systemctl enable"
alias sen="sudo systemctl enable --now"
alias sd="sudo systemctl disable"

# git
alias ga="git add"
alias gc="git commit -m"
alias gs="git status"
alias gd="git diff"
alias gm="git merge"
alias gp="git push"
alias gco="git checkout"

# config
alias zshrc="vim ~/dotfiles/.config/zsh/.zshrc"
alias zshrcsource="source ~/.config/zsh/.zshrc"

# firewalld
alias fcmd="firewall-cmd"

**

zprofile

# Each new shell auto-imports all environment variables.
# Hence exporting needs to be done only once.
# Also, all non-login shells are descendants of a login shell.
# Ergo, exports need to be done in the login shell only.
# Hence, we put exports in .zprofile

# Only vars needed by external commands should be exported.
# Note that you can export vars w/out assigning a value to them.
export XDG_CONFIG_HOME=~/.config
export XDG_CACHE_HOME=~/.cache
export XDG_DATA_HOME=~/.local/share
export XDG_STATE_HOME=~/.config/zsh
export EDITOR=nvim
export VISUAL=nvim
export GUIX_PROFILE="$HOME/.config/guix/current" . "$GUIX_PROFILE/etc/profile"

zshenv

if [[ -z "$XDG_CONFIG_HOME" ]]
then
        export XDG_CONFIG_HOME="$HOME/.config"
fi

if [[ -d "$XDG_CONFIG_HOME/zsh" ]]
then
        export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
fi

Terminal

# Env
env:
  TERM: xterm-256color

# Font configuration
font:
  normal:
    family: inconsolata
    style: Regular
  bold:
    family: inconsolata
    style: Bold
  italic:
    family: inconsolata
    style: Italic
  bold_italic:
    family: inconsolata
    style: Bold Italic
  size: 16