From 85f5be4658280372a332951376eae2ad0693e0af Mon Sep 17 00:00:00 2001 From: agryphus Date: Wed, 2 Aug 2023 00:45:22 -0400 Subject: [PATCH] Initial commit --- .config/X11/xinitrc | 7 ++ .config/conda/condarc | 6 ++ .config/discord/settings.json | 4 + .config/lf/cleaner | 5 + .config/lf/icons | 77 ++++++++++++++++ .config/lf/lfrc | 134 +++++++++++++++++++++++++++ .config/lf/previewer | 60 ++++++++++++ .config/sxhkd/sxhkdrc | 11 +++ .config/tmux/tmux.conf | 22 +++++ .config/zathura/zathurarc | 16 ++++ .config/zsh/.zprofile | 24 +++++ .config/zsh/.zshenv | 59 ++++++++++++ .config/zsh/.zshrc | 169 ++++++++++++++++++++++++++++++++++ .local/bin/dmenuunicode | 19 ++++ .local/bin/lfub | 20 ++++ .local/bin/passmenu | 9 ++ .local/bin/pinentry-wrapper | 14 +++ .local/bin/zathura | 7 ++ 18 files changed, 663 insertions(+) create mode 100644 .config/X11/xinitrc create mode 100644 .config/conda/condarc create mode 100644 .config/discord/settings.json create mode 100755 .config/lf/cleaner create mode 100644 .config/lf/icons create mode 100644 .config/lf/lfrc create mode 100755 .config/lf/previewer create mode 100644 .config/sxhkd/sxhkdrc create mode 100644 .config/tmux/tmux.conf create mode 100644 .config/zathura/zathurarc create mode 100644 .config/zsh/.zprofile create mode 100644 .config/zsh/.zshenv create mode 100755 .config/zsh/.zshrc create mode 100755 .local/bin/dmenuunicode create mode 100755 .local/bin/lfub create mode 100755 .local/bin/passmenu create mode 100755 .local/bin/pinentry-wrapper create mode 100755 .local/bin/zathura diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc new file mode 100644 index 0000000..2d333b0 --- /dev/null +++ b/.config/X11/xinitrc @@ -0,0 +1,7 @@ +feh --no-fehbg --bg-fill ~/.config/wallpaper +xset r rate 300 50 +killall picom +picom -b +sxhkd & +dwm + diff --git a/.config/conda/condarc b/.config/conda/condarc new file mode 100644 index 0000000..4a7aae2 --- /dev/null +++ b/.config/conda/condarc @@ -0,0 +1,6 @@ +envs_dirs: + - ${XDG_DATA_HOME}/conda/envs +pkgs_dirs: + - ${XDG_CACHE_HOME}/conda/pkgs +auto_activate_base: false + diff --git a/.config/discord/settings.json b/.config/discord/settings.json new file mode 100644 index 0000000..d7beaa8 --- /dev/null +++ b/.config/discord/settings.json @@ -0,0 +1,4 @@ +{ + SKIP_HOST_UPDATE: true +} + diff --git a/.config/lf/cleaner b/.config/lf/cleaner new file mode 100755 index 0000000..abe2208 --- /dev/null +++ b/.config/lf/cleaner @@ -0,0 +1,5 @@ +#!/bin/sh +if [ -n "$FIFO_UEBERZUG" ]; then + printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG" +fi + diff --git a/.config/lf/icons b/.config/lf/icons new file mode 100644 index 0000000..aad068c --- /dev/null +++ b/.config/lf/icons @@ -0,0 +1,77 @@ +di 📁 +fi 📃 +tw 🤝 +ow 📂 +ln ⛓ +or ❌ +ex 🎯 +*.txt ✍ +*.mom ✍ +*.me ✍ +*.ms ✍ +*.avif 🖼 +*.png 🖼 +*.webp 🖼 +*.ico 🖼 +*.jpg 📸 +*.jpe 📸 +*.jpeg 📸 +*.gif 🖼 +*.svg 🗺 +*.tif 🖼 +*.tiff 🖼 +*.xcf 🖌 +*.html 🌎 +*.xml 📰 +*.gpg 🔒 +*.css 🎨 +*.pdf 📚 +*.djvu 📚 +*.epub 📚 +*.csv 📓 +*.xlsx 📓 +*.tex 📜 +*.md 📘 +*.r 📊 +*.R 📊 +*.rmd 📊 +*.Rmd 📊 +*.m 📊 +*.mp3 🎵 +*.opus 🎵 +*.ogg 🎵 +*.m4a 🎵 +*.flac 🎼 +*.wav 🎼 +*.mkv 🎥 +*.mp4 🎥 +*.webm 🎥 +*.mpeg 🎥 +*.avi 🎥 +*.mov 🎥 +*.mpg 🎥 +*.wmv 🎥 +*.m4b 🎥 +*.flv 🎥 +*.zip 📦 +*.rar 📦 +*.7z 📦 +*.tar 📦 +*.z64 🎮 +*.v64 🎮 +*.n64 🎮 +*.gba 🎮 +*.nes 🎮 +*.gdi 🎮 +*.1 ℹ +*.nfo ℹ +*.info ℹ +*.log 📙 +*.iso 📀 +*.img 📀 +*.bib 🎓 +*.ged 👪 +*.part 💔 +*.torrent 🔽 +*.jar ♨ +*.java ♨ diff --git a/.config/lf/lfrc b/.config/lf/lfrc new file mode 100644 index 0000000..5477dfe --- /dev/null +++ b/.config/lf/lfrc @@ -0,0 +1,134 @@ +# Basic vars +set shellopts '-eu' +set ifs "\n" +set scrolloff 10 +set icons +set period 1 +set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" +set cleaner '~/.config/lf/cleaner' +set previewer '~/.config/lf/previewer' +set autoquit true + +# cmds/functions +cmd open ${{ + case $(file --mime-type "$(readlink -f $f)" -b) in + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;; + image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; + text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; + image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; + image/svg+xml) display -- $f ;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" | + setsid -f sxiv -aio 2>/dev/null | while read -r file; do + [ -z "$file" ] && continue + lf -remote "send select \"$file\"" + lf -remote "send toggle" + done & + ;; + audio/*|video/x-ms-asf) mpv --audio-display=no $f ;; + video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; + application/pgp-encrypted) $EDITOR $fx ;; + application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;; + *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; + esac +}} + +cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" + +cmd extract ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "extract?[y/N]" + read ans + [ $ans = "y" ] && aunpack $fx +}} + +cmd delete ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "delete?[y/N]" + read ans + [ $ans = "y" ] && rm -rf -- $fx +}} + +cmd moveto ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + clear; echo "Move to where?" + dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" && + for x in $fx; do + eval mv -iv \"$x\" \"$dest\" + done && + notify-send "🚚 File(s) moved." "File(s) moved to $dest." +}} + +cmd copyto ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + clear; echo "Copy to where?" + dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" && + for x in $fx; do + eval cp -ivr \"$x\" \"$dest\" + done && + notify-send "📋 File(s) copied." "File(s) copies to $dest." +}} + +cmd setbg "$1" + +cmd bulkrename ${{ + tmpfile_old="$(mktemp)" + tmpfile_new="$(mktemp)" + + [ -n "$fs" ] && fs=$(basename -a $fs) || fs=$(ls) + + echo "$fs" > "$tmpfile_old" + echo "$fs" > "$tmpfile_new" + $EDITOR "$tmpfile_new" + + [ "$(wc -l < "$tmpfile_old")" -eq "$(wc -l < "$tmpfile_new")" ] || { rm -f "$tmpfile_old" "$tmpfile_new"; exit 1; } + + paste "$tmpfile_old" "$tmpfile_new" | while IFS="$(printf '\t')" read -r src dst + do + [ "$src" = "$dst" ] || [ -e "$dst" ] || mv -- "$src" "$dst" + done + + rm -f "$tmpfile_old" "$tmpfile_new" + lf -remote "send $id unselect" +}} + +# Bindings +map $lf -remote "send $id select \"$(fzf)\"" +map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" +map gh +map g top +map D delete +map E extract +map C copyto +map M moveto +map push :mkdir +map reload +map set hidden! +map shell +map x $$f +map X !$f +map o &mimeopen "$f" +map O $mimeopen --ask "$f" + +map A :rename; cmd-end # at the very end +map c push A # new rename +map I :rename; cmd-home # at the very beginning +map i :rename # before extension +map a :rename; cmd-right # after extension +map B bulkrename +map b $setbg $f + +map down +map up +map V push :!nvim + +map W $setsid -f $TERMINAL >/dev/null 2>&1 + +map Y $printf "%s" "$fx" | xclip -selection clipboard + diff --git a/.config/lf/previewer b/.config/lf/previewer new file mode 100755 index 0000000..0b66865 --- /dev/null +++ b/.config/lf/previewer @@ -0,0 +1,60 @@ +#!/bin/sh +CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' \ + -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))" + +image() { + # if [ -n "$DISPLAY" ]; then + # printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y":"%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' \ + # "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG" + # exit 1 + # else + chafa "$1" -s "$4x" + # fi +} + +batorcat() { + file="$1" + shift + if command -v bat > /dev/null 2>&1 + then + bat --color=always --style=plain --pager=never "$file" "$@" + else + cat "$file" + fi +} + +case "$(file --dereference --brief --mime-type -- "$1")" in + image/*) + image "$1" "$2" "$3" "$4" "$5" "$1" + ;; + # text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; + # text/troff) man ./ "$1" | col -b ;; + text/* | */xml | application/json) + bat --terminal-width "$(($4-2))" -f "$1" + ;; + # audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; + # video/* ) + # CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + # [ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + # image "$CACHE" "$2" "$3" "$4" "$5" "$1" + # ;; + # */pdf) + # CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + # [ ! -f "$CACHE.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" + # image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + # ;; + # */epub+zip|*/mobi*) + # CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + # [ ! -f "$CACHE.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg" + # image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + # ;; + # application/*zip) atool --list -- "$1" ;; + # *opendocument*) odt2txt "$1" ;; + # application/pgp-encrypted) gpg -d -- "$1" ;; + *) + file -ibL "$1" | grep -q text && batorcat "$1" || file -Lb "$1" + ;; +esac + +exit 0 + diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc new file mode 100644 index 0000000..f9d6529 --- /dev/null +++ b/.config/sxhkd/sxhkdrc @@ -0,0 +1,11 @@ +super + d + dmenu_run +super + D + passmenu +super + Return + st +super + grave + dmenuunicode +super + w + thorium-browser + diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..d87e325 --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,22 @@ +# Stop tmux from override terminal colors +set-option -ga terminal-overrides ",xterm-256color:Tc" + +# Change tmux prefix +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +set -g status-style 'bg=#333333 fg=#5eacd3' + +# Vim-like visual mode and yanking +set-window-option -g mode-keys vi +bind -T copy-mode-vi v send-keys -X begin-selection +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' + +# Vim-like pane switching +bind -r ^ last-window +bind -r k select-pane -U +bind -r j select-pane -D +bind -r h select-pane -L +bind -r l select-pane -R + diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc new file mode 100644 index 0000000..af72437 --- /dev/null +++ b/.config/zathura/zathurarc @@ -0,0 +1,16 @@ +set sandbox none +set statusbar-h-padding 0 +set statusbar-v-padding 0 +set page-padding 1 +set selection-clipboard clipboard +map u scroll half-up +map d scroll half-down +map D toggle_page_mode +map r reload +map R rotate +map K zoom in +map J zoom out +map i recolor +map p print +map g goto top + diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile new file mode 100644 index 0000000..6ed631c --- /dev/null +++ b/.config/zsh/.zprofile @@ -0,0 +1,24 @@ +# ZSH Configurations +unsetopt autocd # Change directory just by typing its name (hurts performance) +setopt interactivecomments # Allow comments in interactive mode +setopt magicequalsubst # Enable filename expansion for arguments of the form ‘anything=expression’ +setopt nonomatch # Hide error message if there is no match for the pattern +setopt notify # Report the status of background jobs immediately +setopt numericglobsort # Sort filenames numerically when it makes sense +setopt promptsubst # Enable command substitution in prompt +setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE +setopt hist_ignore_dups # ignore duplicated commands history list +setopt hist_ignore_space # ignore commands that start with space +setopt hist_verify # show command with history expansion to user before running it +unsetopt ksharrays # 0-indexing arrays breaks highlighting + +# Start gpg agent +unset SSH_AGENT_PID +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +fi +eval $(gpg-agent --daemon) + +export PATH=$PATH:~/.local/share/cargo/bin/ + +export PATH=~/.local/bin:$PATH # Highest precedence to local bin diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv new file mode 100644 index 0000000..c62d4c7 --- /dev/null +++ b/.config/zsh/.zshenv @@ -0,0 +1,59 @@ +#!/bin/zsh + +source /opt/miniconda3/etc/profile.d/conda.sh + +# Spring cleaning +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_STATE_HOME="$HOME/.local/state" +export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/config" +export EMACS_INIT_FILE="$XDG_CONFIG_HOME/emacs" +export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" +export GIT_CONFIG="$XDG_CONFIG_HOME/git/config" +export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store" +export CARGO_HOME="$XDG_DATA_HOME/cargo" +export RUSTUP_HOME="$XDG_DATA_HOME/rustup" +export GNUPGHOME="$XDG_DATA_HOME/gnupg" +export NPM_CONFIG_PREFIX="$XDG_CACHE_HOME/npm" +export TEXMFVAR=$XDG_CACHE_HOME/texlive/texmf-var +export VIMINFO="$XDG_STATE_HOME/vim/viminfo" +export TMUX_TMPDIR="$XDG_RUNTIME_DIR" + +export BROWSER='thorium-browser' +export EDITOR='nvim' + +export SUDO_PROMPT=" + ⢀⡔⣻⠁ ⢀⣀⣀⡀ + ⢀⣾⠳⢶⣦⠤⣀ ⣾⢀⡇⡴⠋⣀⠴⣊⣩⣤⠶⠞⢹⣄ + ⢸ ⢠⠈⠙⠢⣙⠲⢤⠤⠤ ⠒⠳⡄⣿⢀⠾⠓⢋⠅⠛⠉⠉⠝ ⠼ + ⢸ ⢰⡀⠁ ⠈⠑⠦⡀ ⠈⠺⢿⣂ ⠉⠐⠲⡤⣄⢉⠝⢸ + ⢸ ⢀⡹⠆ ⡠⠃ ⠉⠙⠲⣄ ⠙⣷⡄⢸ + ⢸⡀⠙⠂⢠ ⡠⠊ ⢠ ⠘⠄ ⠑⢦⣔ ⢡⡸ + ⢀⣧ ⢀⡧⣴⠯⡀ ⡎ ⢸⡠⠔⠈⠁⠙⡗⡤⣷⡀ + ⡜⠈⠚⠁⣬⠓⠒⢼⠅ ⣠⡇ ⣧ ⡀⢹ ⠸⡄ + ⡸ ⠘⢸⢀⠐⢃ ⡰⠋⡇ ⢠ ⡿⣆ ⣧⡈⡇⠆⢻ + ⢰⠃ ⢀⡇⠼⠉ ⢸⡤⠤⣶⡖⠒⠺⢄⡀⢀⠎⡆⣸⣥⠬⠧⢴⣿⠉⠁⠸⡀⣇ + ⠇ ⢸ ⣰⠋ ⢸⣿⣿ ⠙⢧⡴⢹⣿⣿ ⠈⣆ ⢧⢹⡄ + ⣸ ⢠ ⢸⡀ ⢻⡀ ⢸⣿⣿ ⡼⣇⢸⣿⣿ ⢀⠏ ⢸ ⠇ + ⠓⠈⢃ ⡇ ⣗⠦⣀⣿⡇ ⣀⠤⠊ ⠈⠺⢿⣃⣀⠤⠔⢸ ⣼⠑⢼ + ⢸⡀⣀⣾⣷⡀ ⢸⣯⣦⡀ ⢇⣀⣀⠐⠦⣀⠘ ⢀⣰⣿⣄ ⡟ + ⠛⠁⣿⣿⣧ ⣿⣿⣿⣿⣦⣀ ⣀⣠⣴⣿⣿⡿⠈⠢⣼⡇ + ⠈⠁⠈⠻⠈⢻⡿⠉⣿⠿⠛⡇⠒⠒⢲⠺⢿⣿⣿⠉⠻⡿⠁ ⠈⠁ +⢀⠤⠒⠦⡀ ⢀⠞⠉⠆ ⠉⠉⠉ ⡝⣍ +⡎ ⡇ ⡰⠋ ⢸ ⢡⠈⢦ +⡇ ⠸⠁ ⢀⠜⠁ ⡸ ⠘⡄⠈⢳⡀ +⡇ ⢠ ⠠⣯⣀ ⡰⡇ ⢣ ⢀⡦⠤⢄⡀ +⢱⡀ ⠈⠳⢤⣠⠖⠋⠛⠛⢷⣄⢠⣷⠁ ⠘⡾⢳⠃ ⠘⢇ + ⠙⢦⡀ ⢠⠁ ⠙⣿⣏⣀ ⣀⣴⣧⡃ ⣸ + ⠈⠉⢺⣄ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⣤⣀⣠⡾⠃ + ⠣⢅⡤⣀⣀⣠⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠉⠉⠉ + ⠉⠉⠉⠁ ⠉⣿⣿⣿⣿⣿⡿⠻⣿⣿⣿⣿⠛⠉ + ⣸⣿⣿⣿ ⣿⣿⣿⡿ + ⣴⣿⣿⣿⣟ ⢠⣿⣿⣿⣿⣧ + ⢰⣿⣿⣿⣿⣿ ⢸⣿⣿⣿⣿⣿ + ⢸⣿⣿⣿⣿⡏ ⢸⣿⣿⣿⣿⣿⡀ + ⢠⣿⣿⣿⣿⣿ ⢺⣿⣿⣿⣿⣿⣿⣷ + ⣿⣿⣿⣿⣿⣿ ⠈⠉⠻⣿⣿⣿⠟ + ⠘⢿⣿⣿⣿⠏ Dori dori" + diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc new file mode 100755 index 0000000..9419ada --- /dev/null +++ b/.config/zsh/.zshrc @@ -0,0 +1,169 @@ +alias ll='ls -l' +alias la='ls -A' +alias l='ls -CF' +alias python='python3' +alias clip=/mnt/c/Windows/System32/clip.exe +alias startx="export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0 && \ + export LD_LIBRARY_PATH=/usr/lib/wsl/lib && \ + export LIBGL_ALWAYS_SOFTWARE=1 && \ + . ~/.config/X11/xinitrc" +alias vcxsrv='/mnt/c/Program\ Files/VcXsrv/vcxsrv.exe :0 -clipboard -wgl -keyhook' +alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' + +alias config='git --git-dir $HOME/repos/archrice/ --work-tree=$HOME' + +# Print out all colors +alias colors='for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$"\n"}; done' + +# Colors +alias ls='LC_COLLATE=C ls --color=auto --group-directories-first -hN -A' +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' +alias diff='diff --color=auto' +alias ip='ip --color=auto' + +# Enable completion features +autoload -Uz compinit +compinit -d ~/.cache/zcompdump +zstyle ':completion:*:*:*:*:*' menu select +zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # case insensitive tab completion + +# Remove green background of simlinks +LS_COLORS+=':ow=01;33' + +# Don't consider certain characters part of the word +WORDCHARS=${WORDCHARS//\/} + +# History configurations +export HISTFILE=~/.local/share/history +HISTSIZE=1000 +SAVEHIST=2000 +alias history="history 0" # force zsh to show the complete history + +export GPG_TTY=$(tty) + +# Building the prompt +C_PROMPT="%F{cyan}" +C_GIT="%F{green}" +C_CONDA="%F{009}" +C_DIR="%F{yellow}" +C_RESET="%F{reset}" +RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})' +err="$?" +curr_time="%*" +dir='%(4~|.../%3~|%~)' # 3 deep, or truncation + +function precmd { + PROMPT="${C_PROMPT}[$USERNAME@$(sed 1q /etc/hostname)${C_DIR}:${dir}${C_PROMPT}]" + extra="$(parse_conda)$(parse_git)" + if [ ! -z "$extra" ]; then + PROMPT+=$'\n'"$extra" + fi + PROMPT+="${C_RESET}$ " +} + +function parse_git() { + if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + echo "" + return + fi + + # Get branch + local branch + branch="$(git symbolic-ref HEAD 2> /dev/null)" + branch="${branch#refs/heads/}" + # If we're in detached HEAD the above doesn't work, so use reflog instead + [[ -z $branch ]] && branch="$(git reflog HEAD | grep 'checkout:' | head -n1 | grep -oE '[^ ]+$')" + + # Check dirty status + [[ -z $(git status --porcelain 2> /dev/null) ]] \ + && dirty="%F{green}✓${C_RESET}" \ + || dirty="%F{red}✗${C_RESET}" + + # Get our branch or ref, depending if we're in detached HEAD or not. + ref=$(git symbolic-ref HEAD 2>/dev/null) \ + && { ref=${ref#refs/heads/} ; branch="$ref" ; } \ + || ref=$(git reflog HEAD | awk 'NR==1 && /checkout:/ { print $NF }') + + # Checking number of comits ahead or behind + upstream_ref=$(git for-each-ref --format='%(refname:short)|%(upstream:short)' refs/heads \ + | grep "^$branch|" \ + | cut -d'|' -f2) + + if [[ "$upstream_ref" ]]; then + updown=( $(git rev-list --count --left-right "$upstream_ref"...HEAD) ) + + [[ ${updown[1]} -gt 0 ]] && tracking+="%F{red}-${updown[1]}${C_RESET}:" # Behind + [[ ${updown[2]} -gt 0 ]] && tracking+="%F{magenta}+${updown[2]}${C_RESET}:" # Ahead + fi + + # Put together our prompt string + git_prompt+="${C_GIT}[" + git_prompt+="${ref}:${C_RESET}" + git_prompt+="${tracking}" + git_prompt+="${dirty}" + git_prompt+="${C_GIT}]${C_RESET}" + + echo "$git_prompt" +} + +function parse_conda() { + env=$CONDA_DEFAULT_ENV + if [ -z "$env" ] || [ "$env" = "base" ]; then + echo "" + return + fi + + echo "${C_CONDA}[$env]" +} + +# Config for zsh-syntax-highlighting +LIGHT_GREY=242 +. ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern) +ZSH_HIGHLIGHT_STYLES[arg0]=fg=yello +ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold +ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline +ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=$LIGHT_GREY +ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=$LIGHT_GREY +ZSH_HIGHLIGHT_STYLES[global-alias]=fg=magenta +ZSH_HIGHLIGHT_STYLES[precommand]=fg=cyan +ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold +ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold +ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold +ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta +ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta +ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold +ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow +ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow +ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow +ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta +ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta +ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta +ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta +ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold +ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold +ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold +ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold +ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold +ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold +ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold +ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold +ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout + +# Unset styles +ZSH_HIGHLIGHT_STYLES[path]=none +ZSH_HIGHLIGHT_STYLES[assign]=none +ZSH_HIGHLIGHT_STYLES[default]=none +ZSH_HIGHLIGHT_STYLES[named-fd]=none +ZSH_HIGHLIGHT_STYLES[numeric-fd]=none +ZSH_HIGHLIGHT_STYLES[unknown-token]=none +ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none +ZSH_HIGHLIGHT_STYLES[command-substitution]=none +ZSH_HIGHLIGHT_STYLES[process-substitution]=none +ZSH_HIGHLIGHT_STYLES[path_pathseparator]= +ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]= + +source ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh + diff --git a/.local/bin/dmenuunicode b/.local/bin/dmenuunicode new file mode 100755 index 0000000..367d176 --- /dev/null +++ b/.local/bin/dmenuunicode @@ -0,0 +1,19 @@ +#!/bin/sh + +# The famous "get a menu of emojis to copy" script. + +# Get user selection via dmenu from emoji file. +chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | dmenu -i -l 30 | sed "s/ .*//") + +# Exit if none chosen. +[ -z "$chosen" ] && exit + +# If you run this command with an argument, it will automatically insert the +# character. Otherwise, show a message that the emoji has been copied. +if [ -n "$1" ]; then + xdotool type "$chosen" +else + printf "%s" "$chosen" | xclip -selection clipboard + notify-send "'$chosen' copied to clipboard." & +fi + diff --git a/.local/bin/lfub b/.local/bin/lfub new file mode 100755 index 0000000..92c5f56 --- /dev/null +++ b/.local/bin/lfub @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +cleanup() { + exec 3>&- + rm "$FIFO_UEBERZUG" +} + +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$@" +else + [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf" + export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s --output x11 <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup HUP INT QUIT TERM PWR EXIT + lf "$@" 3>&- +fi + diff --git a/.local/bin/passmenu b/.local/bin/passmenu new file mode 100755 index 0000000..22f93e7 --- /dev/null +++ b/.local/bin/passmenu @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# This script exists because I want to use dmenu instead of dmenu-wl, which passmenu +# defaults to if it sees that your $WAYLAND_DISPLAY variable is set. I also passed +# $PINENTRY_USER_DATA which will eventually reach the pinentry-wrapper script and launch +# a graphical pinentry as opposed to my curses default, since launching pinentry-curses +# outside of a terminal just breaks everything. + +PINENTRY_USER_DATA=qt WAYLAND_DISPLAY= /usr/bin/passmenu + diff --git a/.local/bin/pinentry-wrapper b/.local/bin/pinentry-wrapper new file mode 100755 index 0000000..a93a9f1 --- /dev/null +++ b/.local/bin/pinentry-wrapper @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# +# Defaults to Qt, with a choice of curses for selected programs +# PINENTRY_USER_DATA is a GnuPG defined variable (see man gpg) + +case "$PINENTRY_USER_DATA" in + qt) + exec /usr/bin/pinentry-qt "$@" + ;; + *) + exec /usr/bin/pinentry-curses "$@" + ;; +esac + diff --git a/.local/bin/zathura b/.local/bin/zathura new file mode 100755 index 0000000..387908a --- /dev/null +++ b/.local/bin/zathura @@ -0,0 +1,7 @@ +#!/usr/bin/sh +# This was created because the x backend of zathura did not want to listen +# to the $DISPLAY environment variable and refused to open inside of my VcXsrv x +# server instance. I could not alias this in my .zshrc either because when zathura +# is launched from dmenu or from vimtex, it would not follow the alias. +GDK_BACKEND=x11 /usr/bin/zathura "$@" +