]> git.newer.systems Git - configs.git/commitdiff
init
authorTucker Johnson <tucker@newer.systems>
Sat, 16 May 2026 12:36:04 +0000 (08:36 -0400)
committerTucker Johnson <tucker@newer.systems>
Sat, 16 May 2026 12:36:04 +0000 (08:36 -0400)
17 files changed:
.config/lf/icons [new file with mode: 0644]
.config/lf/lfrc [new file with mode: 0644]
.config/lf/scope [new file with mode: 0755]
.config/newsboat/config [new file with mode: 0644]
.config/shell/aliasrc [new file with mode: 0644]
.config/shell/bm-dirs [new file with mode: 0644]
.config/shell/bm-files [new file with mode: 0644]
.config/shell/inputrc [new file with mode: 0644]
.config/shell/profile [new file with mode: 0644]
.config/zsh/.zshrc [new file with mode: 0644]
.gitignore [new file with mode: 0644]
.local/bin/linkhandler [new file with mode: 0755]
.local/bin/maimpick [new file with mode: 0755]
.local/bin/qndl [new file with mode: 0755]
.local/bin/rotdir [new file with mode: 0755]
.local/bin/shortcuts [new file with mode: 0755]
Makefile [new file with mode: 0644]

diff --git a/.config/lf/icons b/.config/lf/icons
new file mode 100644 (file)
index 0000000..df1666a
--- /dev/null
@@ -0,0 +1,107 @@
+di     đŸ“
+fi     đŸ“„
+tw     đŸ¤
+ow     đŸ“‚
+ln     đŸ”—
+or     â“
+ex     â—
+*.txt  đŸ“
+*.mom  âœ’ī¸
+*.me   âœ’ī¸
+*.ms   âœ’ī¸
+*.ly   đŸŽŧ
+*.avif đŸ–ŧ
+*.png  đŸ–ŧ
+*.webp đŸ–ŧ
+*.ico  đŸ–ŧ
+*.jpg  đŸ“¸
+*.jpe  đŸ“¸
+*.jpeg đŸ“¸
+*.gif  đŸ–ŧ
+*.svg  đŸ—ē
+*.tif  đŸ–ŧ
+*.tiff đŸ–ŧ
+*.xcf  đŸ–Œ
+*.html đŸŒŽ
+*.xml  đŸ“°
+*.gpg  đŸ”’
+*.css  đŸŽ¨
+*.pdf  đŸ“•
+*.djvu đŸ“—
+*.epub đŸ“—
+*.csv  đŸ“’
+*.xlsx đŸ“’
+*.sc   đŸ“’
+*.sent  đŸ“Ŋī¸
+*.tex  âœ’ī¸
+*.md   đŸ“”
+*.r        đŸ“Š
+*.R        đŸ“Š
+*.rmd  đŸ“Š
+*.Rmd  đŸ“Š
+*.m        đŸ“Š
+*.mp3  đŸŽĩ
+*.opus đŸŽĩ
+*.ogg  đŸŽĩ
+*.m4a  đŸŽĩ
+*.flac đŸŽļ
+*.wav  đŸŽļ
+*.midi  đŸŽš
+*.RPP   đŸŽ™ī¸
+*.ardour    đŸŽ™ī¸
+*.history   â†Šī¸
+*.bak   đŸ‘´
+*.mkv  đŸŽĨ
+*.mp4  đŸŽĨ
+*.webm đŸŽĨ
+*.mpeg đŸŽĨ
+*.avi  đŸŽĨ
+*.mov  đŸŽĨ
+*.mpg  đŸŽĨ
+*.wmv  đŸŽĨ
+*.m4b  đŸŽĨ
+*.flv  đŸŽĨ
+*.zip  đŸ“Ļ
+*.rar  đŸ“Ļ
+*.7z   đŸ“Ļ
+*.tar  đŸ“Ļ
+*.z64  đŸŽŽ
+*.v64  đŸŽŽ
+*.n64  đŸŽŽ
+*.gba  đŸŽŽ
+*.nes  đŸŽŽ
+*.gdi  đŸŽŽ
+*.1        đŸ“–
+*.2        đŸ“–
+*.3        đŸ“–
+*.4        đŸ“–
+*.5        đŸ“–
+*.6        đŸ“–
+*.7        đŸ“–
+*.nfo  đŸ“–
+*.info đŸ“–
+*.log  đŸ“™
+*.iso  đŸ“€
+*.img   đŸ“€
+*.bib   đŸŽ“
+*.ref   đŸŽ“
+*.ged   đŸ‘Ē
+*.part  đŸ’”
+*.torrent đŸ”Ŋ
+*.jar   â™¨
+*.java â™¨
+*.lua   đŸŒ™
+*.c     đŸ„
+*.h     đŸ„
+*.elf   đŸ§
+*.o     đŸĒ¨
+*.rem   đŸ“†
+*.ttl   đŸĸ
+*.peak  đŸ”ī¸
+*.hex   đŸ”ĸ
+*Makefile   đŸ”§
+*makefile   đŸ”§
+*.mk   đŸ”§
+*.gitignore đŸ‘Œ
+*LICENSE    âš–ī¸
+*license    âš–ī¸
diff --git a/.config/lf/lfrc b/.config/lf/lfrc
new file mode 100644 (file)
index 0000000..eef7eff
--- /dev/null
@@ -0,0 +1,177 @@
+# 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 previewer '~/.config/lf/scope'
+set autoquit true
+
+# cmds/functions
+cmd open ${{
+    case $(file --mime-type "$(readlink -f $f)" -b) in
+       application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
+    application/x-sc) sc-im $fx ;;
+       image/vnd.djvu|application/pdf|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 nsxiv -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) setsid -f zathura $fx >/dev/null 2>&1 ;;
+    application/vnd.djvu|application/epub*) baca $fx ;;
+       application/pgp-encrypted) $EDITOR $fx ;;
+       application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|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 ;;
+        application/octet-stream) case ${f##*.} in
+                       doc|docx|xls|xlsx|odt|ppt|pptx) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
+                       ghw) setsid -f gtkwave $f >/dev/null 2>&1 ;;
+                       ts) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
+                       *) setsid -f zathura $fx >/dev/null 2>&1 ;;
+               esac ;;
+       *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
+    esac
+}}
+
+cmd mkdir $mkdir -p "$@"
+
+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" ] && {
+               case $fx in
+                       *.tar.bz2)   tar xjf $fx     ;;
+                       *.tar.gz)    tar xzf $fx     ;;
+                       *.bz2)       bunzip2 $fx     ;;
+                       *.rar)       unrar e $fx     ;;
+                       *.gz)        gunzip $fx      ;;
+                       *.tar)       tar xf $fx      ;;
+                       *.tbz2)      tar xjf $fx     ;;
+                       *.tgz)       tar xzf $fx     ;;
+                       *.zip)       unzip $fx       ;;
+                       *.Z)         uncompress $fx  ;;
+                       *.7z)        7z x $fx        ;;
+                       *.tar.xz)    tar xf $fx      ;;
+               esac
+       }
+}}
+
+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 ${{
+       set -f
+       dest=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" | fzf --prompt 'Move to where? ' | sed 's|~|$HOME|')
+       [ -z "$dest" ] && exit
+       destpath=$(eval printf '%s' \"$dest\")
+       clear; tput cup $(($(tput lines)/3)); tput bold
+       echo "From:"
+       echo "$fx" | sed 's/^/   /'
+       printf "To:\n   %s\n\n\tmove?[y/N]" "$destpath"
+       read -r ans
+       [ "$ans" != "y" ] && exit
+       for x in $fx; do
+               mv -iv "$x" "$destpath"
+       done &&
+       notify-send "🚚 File(s) moved." "File(s) moved to $destpath."
+}}
+
+cmd copyto ${{
+       set -f
+       dest=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" | fzf --prompt 'Copy to where? ' | sed 's|~|$HOME|')
+       [ -z "$dest" ] && exit
+       destpath=$(eval printf '%s' \"$dest\")
+       clear; tput cup $(($(tput lines)/3)); tput bold
+       echo "From:"
+       echo "$fx" | sed 's/^/   /'
+       printf "To:\n   %s\n\n\tcopy?[y/N]" "$destpath"
+       read -r ans
+       [ "$ans" != "y" ] && exit
+       for x in $fx; do
+               cp -ivr "$x" "$destpath"
+       done &&
+       notify-send "📋 File(s) copied." "File(s) copied to $destpath."
+}}
+
+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 <c-f> $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 H cd ~
+map g top
+map D delete
+map E extract
+map C copyto
+map M moveto
+map <c-n> push :mkdir<space>""<left>
+map <c-r> reload
+map <c-s> set hidden!
+map <enter> 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<c-u> # 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 <c-e> down
+map <c-y> up
+map V push :!nvim<space>
+
+map W $setsid -f $TERMINAL >/dev/null 2>&1
+
+map U $printf "%s" "$fx" | xclip -selection clipboard
+map u $printf "%s" "$fx" | sed 's/.*\///' | xclip -selection clipboard
+map . $printf "%s" "$fx" | sed -E 's/^.+\[/https:\/\/www.youtube.com\/watch?v=/' | sed -E 's/\]\..+//' | xclip -selection clipboard
+map <gt> $printf "%s" "$fx" | sed -E 's/^.+\[/https:\/\/piped.video\/watch?v=/' | sed -E 's/\]\..+//' | xclip -selection clipboard
+map T $nsxiv -t "$(pwd)" # opens thumbnail mode
+map <c-l> unselect
+
+
+
+# Source Bookmarks
+source "~/.config/lf/shortcutrc"
diff --git a/.config/lf/scope b/.config/lf/scope
new file mode 100755 (executable)
index 0000000..3cd316b
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# File preview handler for lf.
+
+set -C -f
+IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}"
+
+
+# Note that the cache file name is a function of file information, meaning if
+# an image appears in multiple places across the machine, it will not have to
+# be regenerated once seen.
+
+case "$(file --dereference --brief --mime-type -- "$1")" in
+       image/avif) 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" ] && magick "$1" "$CACHE.jpg"
+               image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
+       image/vnd.djvu)
+               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" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | magick -density 200 - "$CACHE.jpg" > /dev/null 2>&1
+               image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
+image/svg+xml)
+       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" ] && inkscape --convert-dpi-method=none -o "$CACHE.png" --export-overwrite -D --export-png-color-mode=RGBA_16 "$1"
+       image "$CACHE.png" "$2" "$3" "$4" "$5" "$1"
+       ;;
+  image/x-xcf)
+    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 | awk '{print $1}')"
+    [ ! -f "$CACHE.jpg" ] && magick "$1[0]" "$CACHE.jpg"
+    image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"
+  ;;
+       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 | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;;
+       video/* | */pdf | audio/* | application/octet-stream) mediainfo "$1" || exit 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" ;;
+esac
+exit 1
diff --git a/.config/newsboat/config b/.config/newsboat/config
new file mode 100644 (file)
index 0000000..e5af998
--- /dev/null
@@ -0,0 +1,59 @@
+#show-read-feeds no
+auto-reload yes
+
+external-url-viewer "urlscan -dc -r 'linkhandler {}'"
+
+bind-key j down
+bind-key k up
+bind-key j next articlelist
+bind-key k prev articlelist
+bind-key J next-feed articlelist
+bind-key K prev-feed articlelist
+bind-key G end
+bind-key g home
+bind-key d pagedown
+bind-key u pageup
+bind-key l open
+bind-key h quit
+bind-key a toggle-article-read
+bind-key n next-unread
+bind-key N prev-unread
+bind-key D pb-download
+bind-key U show-urls
+bind-key x pb-delete
+
+color listnormal white default
+color listfocus blue black standout bold
+color listnormal_unread red default
+color listfocus_unread magenta red standout bold
+color info red black bold
+color article white default bold
+
+browser linkhandler
+macro , open-in-browser
+macro t set browser "qndl" ; open-in-browser ; set browser linkhandler
+macro a set browser "tsp yt-dlp --embed-metadata -xic -f bestaudio/best" ; open-in-browser ; set browser linkhandler
+macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler
+macro w set browser "lynx" ; open-in-browser ; set browser linkhandler
+macro d set browser "dm-handler" ; open-in-browser ; set browser linkhandler
+macro c set browser "echo %u | xclip -r -sel c" ; open-in-browser ; set browser linkhandler
+macro C set browser "youtube-viewer --comments=%u" ; open-in-browser ; set browser linkhandler
+macro p set browser "mpv --vid=no --" ; one ; set browser linkhandler
+
+highlight all "---.*---" yellow
+highlight feedlist ".*(0/0))" black
+highlight article "(^Feed:.*|^Title:.*|^Author:.*)" cyan default bold
+highlight article "(^Link:.*|^Date:.*)" default default
+highlight article "https?://[^ ]+" green default
+highlight article "^(Title):.*$" blue default
+highlight article "\\[[0-9][0-9]*\\]" magenta default bold
+highlight article "\\[image\\ [0-9]+\\]" green default bold
+highlight article "\\[embedded flash: [0-9][0-9]*\\]" green default bold
+highlight article ":.*\\(link\\)$" cyan default
+highlight article ":.*\\(image\\)$" blue default
+highlight article ":.*\\(embedded flash\\)$" magenta default
+
+# podboat
+download-path "~/Downloads/podcasts/%h/%n"
+max-downloads 5
+player "mpv"
diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc
new file mode 100644 (file)
index 0000000..9ac21bf
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# Use neovim for vim if present.
+[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d"
+
+# Use $XINITRC variable if file exists.
+[ -f "$XINITRC" ] && alias startx="startx $XINITRC"
+
+[ -f "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC"
+
+# sudo not required for some system commands
+for command in mount umount sv pacman updatedb su shutdown poweroff reboot ; do
+       alias $command="sudo $command"
+done; unset command
+
+se() {
+       choice="$(find ~/.local/bin -mindepth 1 -printf '%P\n' | fzf)"
+       [ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice"
+       }
+
+# Verbosity and settings that you pretty much just always are going to want.
+alias \
+       cp="cp -iv" \
+       mv="mv -iv" \
+       rm="rm -vI" \
+       bc="bc -ql" \
+       rsync="rsync -vrPlu" \
+       mkd="mkdir -pv" \
+       yt="yt-dlp --embed-metadata -i" \
+       yta="yt -x -f bestaudio/best" \
+       ytt="yt --skip-download --write-thumbnail" \
+       ffmpeg="ffmpeg -hide_banner"
+
+# Colorize commands when possible.
+alias \
+       ls="ls -hN --color=auto --group-directories-first" \
+       grep="grep --color=auto" \
+       diff="diff --color=auto" \
+       ccat="highlight --out-format=ansi" \
+       ip="ip -color=auto"
+
+# These common commands are just too long! Abbreviate them.
+alias \
+       z="zathura"
+
+alias \
+       magit="nvim -c MagitOnly" \
+       ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
+    calendar="remind -c+16wtm@2 $CALENDAR"
diff --git a/.config/shell/bm-dirs b/.config/shell/bm-dirs
new file mode 100644 (file)
index 0000000..9d212ec
--- /dev/null
@@ -0,0 +1,14 @@
+# You can add comments to these files with #
+cac ${XDG_CACHE_HOME:-$HOME/.cache}
+cf  ${XDG_CONFIG_HOME:-$HOME/.config}
+D   ${XDG_DOWNLOAD_DIR:-$HOME/Downloads}
+d   ${XDG_DOCUMENTS_DIR:-$HOME/Documents}
+dt  ${XDG_DATA_HOME:-$HOME/.local/share}
+rr  $HOME/.local/src
+h   $HOME
+m   ${XDG_MUSIC_DIR:-$HOME/Music}
+mn  /mnt
+pp  ${XDG_PICTURES_DIR:-$HOME/Pictures}
+sc  $HOME/.local/bin
+src $HOME/.local/src
+vv  ${XDG_VIDEOS_DIR:-$HOME/Videos}
diff --git a/.config/shell/bm-files b/.config/shell/bm-files
new file mode 100644 (file)
index 0000000..2e8864b
--- /dev/null
@@ -0,0 +1,23 @@
+# These files automatically update when edited/saved in vim:
+
+# keys filename                                description
+bf     ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files        # This file, a list of bookmarked files
+bd     ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs         # A list of bookmarked directories similar to this file
+cfx    ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources        # Colors, themes and variables for X11
+cfb    ~/.local/src/dwmblocks/config.h                         # dwmblocks: the status bar for dwm
+
+
+# These do not update automatically, but on the next new instance of a program:
+
+cfv    ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim         # vim/neovim config
+cfz    $ZDOTDIR/.zshrc                                         # zsh (shell) config
+cfa    ${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc         # aliases used by zsh (and potentially other shells)
+cfp    ${XDG_CONFIG_HOME:-$HOME/.config}/shell/profile         # profile file for login settings for zsh
+cfm    ${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc           # mutt (email client) config
+cfn    ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/config       # newsboat (RSS reader)
+cfu    ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls         # RSS urls for newsboat
+cfmb   ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/bindings      # ncmpcpp (music player) keybinds file
+cfmc   ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/config        # ncmpcpp (music player) config
+cfl    ${XDG_CONFIG_HOME:-$HOME/.config}/lf/lfrc               # lf (file browser) config
+cfL    ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope              # lf's scope/preview file
+cfX    ${XDG_CONFIG_HOME:-$HOME/.config}/nsxiv/exec/key-handler        # nsxiv (image viewer) key/script handler
diff --git a/.config/shell/inputrc b/.config/shell/inputrc
new file mode 100644 (file)
index 0000000..f9b94dd
--- /dev/null
@@ -0,0 +1,19 @@
+$include /etc/inputrc
+set editing-mode vi
+$if mode=vi
+
+set show-mode-in-prompt on
+set vi-ins-mode-string \1\e[6 q\2
+set vi-cmd-mode-string \1\e[2 q\2
+
+set keymap vi-command
+# these are for vi-command mode
+Control-l: clear-screen
+Control-a: beginning-of-line
+
+set keymap vi-insert
+# these are for vi-insert mode
+Control-l: clear-screen
+Control-a: beginning-of-line
+
+$endif
diff --git a/.config/shell/profile b/.config/shell/profile
new file mode 100644 (file)
index 0000000..c8df939
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/sh
+# shellcheck disable=SC2155
+
+# Profile file, runs on login. Environmental variables are set here.
+
+# Add all directories in `~/.local/bin` to $PATH
+export PATH="$PATH:$(find ~/.local/bin -type d | paste -sd ':' -)"
+
+unsetopt PROMPT_SP 2>/dev/null
+
+# Default programs:
+export EDITOR="nvim"
+export TERMINAL="st"
+export TERMINAL_PROG="st"
+export BROWSER="librewolf"
+
+# General
+export NOTES="$HOME/Notes"
+export CALENDAR="$HOME/Notes/calendar.rem"
+export TODO="$HOME/Notes/todo.md"
+export RECORDINGS="${XDG_VIDEOS_DIR:-$HOME/Videos}/Recordings"
+export REFER="${XDG_DATA_HOME:-$HOME/.local/share}/groff/library.txt"
+
+# ~/ Clean-up:
+export XDG_CONFIG_HOME="$HOME/.config"
+export XDG_DATA_HOME="$HOME/.local/share"
+export XDG_CACHE_HOME="$HOME/.cache"
+export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
+#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
+export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch-config"
+export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0"
+export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
+export INPUTRC="$XDG_CONFIG_HOME/shell/inputrc"
+export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
+#export GNUPGHOME="$XDG_DATA_HOME/gnupg"
+export WINEPREFIX="$XDG_DATA_HOME/wineprefixes/default"
+export KODI_DATA="$XDG_DATA_HOME/kodi"
+export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store"
+export TMUX_TMPDIR="$XDG_RUNTIME_DIR"
+export ANDROID_SDK_HOME="$XDG_CONFIG_HOME/android"
+export CARGO_HOME="$XDG_DATA_HOME/cargo"
+export GOPATH="$XDG_DATA_HOME/go"
+export GOMODCACHE="$XDG_CACHE_HOME/go/mod"
+export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible/ansible.cfg"
+export UNISON="$XDG_DATA_HOME/unison"
+export HISTFILE="$XDG_DATA_HOME/history"
+export MBSYNCRC="$XDG_CONFIG_HOME/mbsync/config"
+export ELECTRUMDIR="$XDG_DATA_HOME/electrum"
+export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc"
+export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
+
+# Other program settings:
+export DICS="/usr/share/stardict/dic/"
+export SUDO_ASKPASS="/usr/local/bin/dm-pass"
+export FZF_DEFAULT_OPTS="--layout=reverse --height 40%"
+export LESS="R"
+export LESS_TERMCAP_mb="$(printf '%b' '\e[1;31m')"
+export LESS_TERMCAP_md="$(printf '%b' '\e[1;36m')"
+export LESS_TERMCAP_me="$(printf '%b' '\e[0m')"
+export LESS_TERMCAP_so="$(printf '%b' '\e[01;44;33m')"
+export LESS_TERMCAP_se="$(printf '%b' '\e[0m')"
+export LESS_TERMCAP_us="$(printf '%b' '\e[1;32m')"
+export LESS_TERMCAP_ue="$(printf '%b' '\e[0m')"
+export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null"
+export QT_QPA_PLATFORMTHEME="gtk2"        # Have QT use gtk2 theme.
+export MOZ_USE_XINPUT2=1                  # Mozilla smooth scrolling/touchpads.
+export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname
+export _JAVA_AWT_WM_NONREPARENTING=1      # Fix for Java applications in dwm
+
+[ -f "$XDG_CONFIG_HOME/shell/localenvrc" ] && . "$XDG_CONFIG_HOME/shell/localenvrc"
+
+[ ! -f "$XDG_CONFIG_HOME/shell/shortcutrc" ] && setsid -f shortcuts >/dev/null 2>&1
+
+# Start graphical server on user's current tty if not already running.
+[ "$(tty)" = "/dev/tty1" ] && ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC"
+
+# Switch escape and caps if tty and no passwd required:
+sudo -n loadkeys /usr/local/share/kbd/keymaps/ttymaps.kmap 2>/dev/null
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
new file mode 100644 (file)
index 0000000..d299916
--- /dev/null
@@ -0,0 +1,78 @@
+# Enable colors and change prompt:
+autoload -U colors && colors   # Load colors
+PS1="%B%{$fg[grey]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[grey]%}]%{$reset_color%}$%b "
+setopt autocd          # Automatically cd into typed directory.
+stty stop undef                # Disable ctrl-s to freeze terminal.
+setopt interactive_comments
+
+# History in cache directory:
+HISTSIZE=10000000
+SAVEHIST=10000000
+HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history"
+
+# Load aliases and shortcuts if existent.
+[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
+[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
+[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
+
+# Basic auto/tab complete:
+autoload -U compinit
+zstyle ':completion:*' menu select
+zmodload zsh/complist
+compinit
+_comp_options+=(globdots)              # Include hidden files.
+
+# vi mode
+bindkey -v
+export KEYTIMEOUT=1
+
+# Use vim keys in tab complete menu:
+bindkey -M menuselect 'h' vi-backward-char
+bindkey -M menuselect 'k' vi-up-line-or-history
+bindkey -M menuselect 'l' vi-forward-char
+bindkey -M menuselect 'j' vi-down-line-or-history
+bindkey -v '^?' backward-delete-char
+
+# Change cursor shape for different vi modes.
+function zle-keymap-select () {
+    case $KEYMAP in
+        vicmd) echo -ne '\e[1 q';;      # block
+        viins|main) echo -ne '\e[5 q';; # beam
+    esac
+}
+zle -N zle-keymap-select
+zle-line-init() {
+    zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
+    echo -ne "\e[5 q"
+}
+zle -N zle-line-init
+echo -ne '\e[5 q' # Use beam shape cursor on startup.
+preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
+
+# Use lf to switch directories and bind it to ctrl-o
+lfcd () {
+    tmp="$(mktemp -uq)"
+    trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT
+    lf -last-dir-path="$tmp" "$@"
+    if [ -f "$tmp" ]; then
+        dir="$(cat "$tmp")"
+        [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
+    fi
+}
+bindkey -s '^o' '^ulfcd\n'
+
+bindkey -s '^a' '^ubc -lq\n'
+
+bindkey -s '^f' '^ucd "$(dirname "$(fzf)")"\n'
+
+bindkey '^[[P' delete-char
+
+# Edit line in vim with ctrl-e:
+autoload edit-command-line; zle -N edit-command-line
+bindkey '^e' edit-command-line
+bindkey -M vicmd '^[[P' vi-delete-char
+bindkey -M vicmd '^e' edit-command-line
+bindkey -M visual '^[[P' vi-delete
+
+# Load syntax highlighting; should be last.
+source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null
diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..fa9767e
--- /dev/null
@@ -0,0 +1,6 @@
+.config/shell/shortcutrc
+.config/shell/shortcutenvrc
+.config/shell/zshnameddirrc
+.config/shell/localenvrc
+.config/lf/shortcutrc
+.config/newsboat/urls
diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler
new file mode 100755 (executable)
index 0000000..d372d84
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Feed script a url or file location.
+# If an image, it will view in nsxiv,
+# if a video or gif, it will view in mpv
+# if a music file or pdf, it will download,
+# otherwise it opens link in browser.
+
+if [ -z "$1" ]; then
+       url="$(xclip -o)"
+else
+       url="$1"
+fi
+
+case "$url" in
+       *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
+               setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;;
+       *png|*jpg|*jpe|*jpeg|*gif|*webp)
+               curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && nsxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")"  >/dev/null 2>&1 & ;;
+       *pdf|*cbz|*cbr)
+               curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")"  >/dev/null 2>&1 & ;;
+       *mp3|*flac|*opus|*mp3?source*)
+               qndl "$url" 'curl -LO'  >/dev/null 2>&1 ;;
+       *)
+               [ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1
+esac
diff --git a/.local/bin/maimpick b/.local/bin/maimpick
new file mode 100755 (executable)
index 0000000..67b9983
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# This is bound to Shift+PrintScreen by default, requires maim. It lets you
+# choose the kind of screenshot to take, including copying the image or even
+# highlighting an area to copy. scrotcucks on suicidewatch right now.
+
+# variables
+output="$(date '+%y%m%d-%H%M-%S').png"
+xclip_cmd="xclip -sel clip -t image/png"
+ocr_cmd="xclip -sel clip"
+
+case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)\\ncopy selected image to text" | dmenu -l 7 -i -p "Screenshot which area?")" in
+    "a selected area") maim -u -s pic-selected-"${output}" ;;
+    "current window") maim -B -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;;
+    "full screen") maim -q -d 0.2 pic-full-"${output}" ;;
+    "a selected area (copy)") maim -u -s | ${xclip_cmd} ;;
+    "current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;;
+    "full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;;
+    "copy selected image to text") tmpfile=$(mktemp /tmp/ocr-XXXXXX.png) && maim -u -s > "$tmpfile" && tesseract "$tmpfile" - -l eng | ${ocr_cmd} && rm "$tmpfile" ;;
+esac
diff --git a/.local/bin/qndl b/.local/bin/qndl
new file mode 100755 (executable)
index 0000000..48bc61e
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# $1 is a url; $2 is a command
+[ -z "$1" ] && exit
+base="$(basename "$1")"
+notify-send "âŗ Queuing $base..."
+cmd="$2"
+[ -z "$cmd" ] && cmd="yt-dlp --embed-metadata -ic"
+idnum="$(tsp $cmd "$1")"
+realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
+tsp -D "$idnum" mv "$base" "$realname"
+tsp -D "$idnum" notify-send "👍 $realname done."
diff --git a/.local/bin/rotdir b/.local/bin/rotdir
new file mode 100755 (executable)
index 0000000..d171f29
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# When I open an image from the file manager in nsxiv (the image viewer), I want
+# to be able to press the next/previous keys to key through the rest of the
+# images in the same directory. This script "rotates" the content of a
+# directory based on the first chosen file, so that if I open the 15th image,
+# if I press next, it will go to the 16th etc. Autistic, I know, but this is
+# one of the reasons that nsxiv is great for being able to read standard input.
+
+[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
+base="$(basename "$1")"
+ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'
diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts
new file mode 100755 (executable)
index 0000000..80835b0
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+bmdirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs"
+bmfiles="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files"
+
+# Output locations. Unactivated progs should go to /dev/null.
+shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
+shell_env_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc"
+zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
+lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc"
+vim_shortcuts="/dev/null"
+qute_shortcuts="/dev/null"
+fish_shortcuts="/dev/null"
+vifm_shortcuts="/dev/null"
+
+# Remove, prepare files
+rm -f "$lf_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" "$vim_shortcuts" 2>/dev/null
+printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
+printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
+printf "# vim: filetype=sh\\n" > "$shell_env_shortcuts"
+printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
+
+# Format the `directories` file in the correct syntax and sent it to all three configs.
+eval "echo \"$(cat "$bmdirs")\"" | \
+awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
+       printf(\"%s=\42cd %s && ls -A\42 \\\\\n\",\$1,\$2)   >> \"$shell_shortcuts\" ;
+       printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2)   >> \"$shell_env_shortcuts\" ;
+       printf(\"hash -d %s=%s \n\",\$1,\$2)                 >> \"$zsh_named_dirs\"  ;
+       printf(\"abbr %s \42cd %s; and ls -A\42\n\",\$1,\$2) >> \"$fish_shortcuts\"  ;
+       printf(\"map g%s :cd %s<CR>\nmap t%s <tab>:cd %s<CR><tab>\nmap M%s <tab>:cd %s<CR><tab>:mo<CR>\nmap Y%s <tab>:cd %s<CR><tab>:co<CR> \n\",\$1,\$2, \$1, \$2, \$1, \$2, \$1, \$2)       >> \"$vifm_shortcuts\" ;
+       printf(\"config.bind(';%s', \42set downloads.location.directory %s ;; hint links download\42) \n\",\$1,\$2) >> \"$qute_shortcuts\" ;
+       printf(\"map C%s cd \42%s\42 \n\",\$1,\$2)           >> \"$lf_shortcuts\" ;
+       printf(\"cmap ;%s %s\n\",\$1,\$2)                    >> \"$vim_shortcuts\" }"
+
+# Format the `files` file in the correct syntax and sent it to both configs.
+eval "echo \"$(cat "$bmfiles")\"" | \
+awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
+       printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2)  >> \"$shell_shortcuts\" ;
+       printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2)   >> \"$shell_env_shortcuts\" ;
+       printf(\"hash -d %s=%s \n\",\$1,\$2)             >> \"$zsh_named_dirs\"  ;
+       printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\"  ;
+       printf(\"map %s :e %s<CR> \n\",\$1,\$2)          >> \"$vifm_shortcuts\"  ;
+       printf(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2)   >> \"$lf_shortcuts\" ;
+       printf(\"cmap ;%s %s\n\",\$1,\$2)                    >> \"$vim_shortcuts\" }"
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..027cc27
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,11 @@
+PREFIX = /usr/local
+
+install:
+       mkdir -p $(DESTDIR)$(PREFIX)/bin
+       cp -f .local/bin/shortcuts $(DESTDIR)$(PREFIX)/bin/shortcuts
+       chmod 755 $(DESTDIR)$(PREFIX)/bin/shortcuts
+
+uninstall:
+       rm -f $(DESTDIR)$(PREFIX)/bin/shortcuts
+
+.PHONY: install uninstall