diff options
| -rw-r--r-- | .config/lf/cleaner | 4 | ||||
| -rw-r--r-- | .config/lf/icons | 76 | ||||
| -rw-r--r-- | .config/lf/lfrc | 135 | ||||
| -rw-r--r-- | .config/lf/scope | 49 | ||||
| -rw-r--r-- | .config/linuxProfile | 2 | ||||
| -rw-r--r-- | .config/massren/profile.sqlite | bin | 0 -> 151552 bytes | |||
| -rw-r--r-- | .config/mpd/mpd.conf | 2 | ||||
| -rw-r--r-- | .config/redshift/redshift.conf | 7 | ||||
| -rwxr-xr-x | .config/shells/aliasrc | 5 | ||||
| -rwxr-xr-x | .config/xinitrc | 1 | ||||
| -rwxr-xr-x | .local/bin/cs | 9 | ||||
| l--------- | .local/bin/html2pdf | 1 | ||||
| -rwxr-xr-x | .local/bin/internet | 4 | ||||
| -rwxr-xr-x | .local/bin/lfub | 24 | ||||
| -rwxr-xr-x | .local/bin/lower | 5 | ||||
| -rwxr-xr-x | .local/bin/macname | 8 | ||||
| -rwxr-xr-x | .local/bin/mismatch | 12 | ||||
| -rwxr-xr-x | .local/bin/mkwords | 5 | ||||
| -rwxr-xr-x | .local/bin/rotdir | 12 | ||||
| -rwxr-xr-x | .local/bin/upper | 5 | ||||
| -rwxr-xr-x | .local/bin/weather | 2 |
21 files changed, 342 insertions, 26 deletions
diff --git a/.config/lf/cleaner b/.config/lf/cleaner new file mode 100644 index 0000000..a184d84 --- /dev/null +++ b/.config/lf/cleaner @@ -0,0 +1,4 @@ +#!/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..ac8f641 --- /dev/null +++ b/.config/lf/icons @@ -0,0 +1,76 @@ +di 📁 +fi 📃 +tw 🤝 +ow 📂 +ln ⛓ +or ❌ +ex 🎯 +*.txt ✍ +*.mom ✍ +*.me ✍ +*.ms ✍ +*.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..b283473 --- /dev/null +++ b/.config/lf/lfrc @@ -0,0 +1,135 @@ +# Luke's lf settings + + +# Note on Image Previews +# For those wanting image previews, like this system, there are four steps to +# set it up. These are done automatically for LARBS users, but I will state +# them here for others doing it manually. +# +# 1. ueberzug must be installed. +# 2. The scope file (~/.config/lf/scope for me), must have a command similar to +# mine to generate ueberzug images. +# 3. A `set cleaner` line as below is a cleaner script. +# 4. lf should be started through a wrapper script (~/.local/bin/lfub for me) +# that creates the environment for ueberzug. This command can be be aliased +# in your shellrc (`alias lf="lfub") or if set to a binding, should be +# called directly instead of normal lf. + +# 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/scope' +set autoquit on + +# 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) $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\|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/*) mpv --audio-display=no $f ;; + video/*|application/vnd.rn-realmedia) 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) setsid -f lowriter $fx >/dev/null 2>&1 ;; + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f localc $fx >/dev/null 2>&1 ;; + application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint) setsid -f loimpress $fx >/dev/null 2>&1 ;; + application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template) setsid -f lodraw $fx >/dev/null 2>&1 ;; + application/vnd.oasis.opendocument.formula) setsid -f lomath $fx >/dev/null 2>&1 ;; + application/vnd.oasis.opendocument.database) setsid -f lobase $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 $vidir + +# 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 gh +map g top +map D delete +map E extract +map C copyto +map M moveto +map <c-n> push :mkdir<space> +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 # at the very end +map c push A<c-u> # new rename +map I push A<c-a> # at the very beginning +map i push A<a-b><a-b><a-f> # before extension +map a push A<a-b> # 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 Y $printf "%s" "$fx" | xclip -selection clipboard diff --git a/.config/lf/scope b/.config/lf/scope new file mode 100644 index 0000000..1d83527 --- /dev/null +++ b/.config/lf/scope @@ -0,0 +1,49 @@ +#!/bin/sh + +# File preview handler for lf. + +set -C -f +IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" + +image() { + if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; 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" + else + mediainfo "$6" + fi +} + +ifub() { + [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1 +} + +# 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/*) 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" ;; +esac +exit 1 diff --git a/.config/linuxProfile b/.config/linuxProfile index c50e092..c309288 100644 --- a/.config/linuxProfile +++ b/.config/linuxProfile @@ -1,5 +1,5 @@ # Default programs: -export PATH=$PATH:$HOME/.local/bin:/opt/sparc/bin +export PATH=$PATH:$HOME/.local/bin:/opt/sparc/bin:$HOME/go/bin export EDITOR="nvim" export TERMINAL="st" export BROWSER="firefox" diff --git a/.config/massren/profile.sqlite b/.config/massren/profile.sqlite Binary files differnew file mode 100644 index 0000000..de03dda --- /dev/null +++ b/.config/massren/profile.sqlite diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf index b57da9c..e44864c 100644 --- a/.config/mpd/mpd.conf +++ b/.config/mpd/mpd.conf @@ -1,4 +1,4 @@ -music_directory "~/Music" +music_directory "~/Music/flac" playlist_directory "~/.config/mpd/playlists" db_file "~/.config/mpd/database" diff --git a/.config/redshift/redshift.conf b/.config/redshift/redshift.conf new file mode 100644 index 0000000..32d277d --- /dev/null +++ b/.config/redshift/redshift.conf @@ -0,0 +1,7 @@ +[redshift] +adjustment-method=randr +location-provider=manual + +[manual] +lat=40.232169 +lon=-75.403293 diff --git a/.config/shells/aliasrc b/.config/shells/aliasrc index c05114a..bc27955 100755 --- a/.config/shells/aliasrc +++ b/.config/shells/aliasrc @@ -39,6 +39,7 @@ alias \ gp="git push" \ m="micro" \ v="nvim" \ - python="python3" \ - pip="pip3" + python="python3.10" \ + pip="pip3.10" \ + lf="lfub" diff --git a/.config/xinitrc b/.config/xinitrc index 4eef6ce..f6555de 100755 --- a/.config/xinitrc +++ b/.config/xinitrc @@ -4,5 +4,6 @@ exec /usr/bin/picom & exec /usr/bin/mpd /home/jmm/.config/mpd/mpd.conf & exec $HOME/.local/bin/keys & exec /usr/bin/pipewire & +exec /usr/bin/redshift -c $HOME/.config/redshift/redshift.conf & [ $wm == "/usr/local/bin/dwm" ] && exec /usr/local/bin/dwmblocks & exec $wm diff --git a/.local/bin/cs b/.local/bin/cs new file mode 100755 index 0000000..9819dbd --- /dev/null +++ b/.local/bin/cs @@ -0,0 +1,9 @@ +#!/bin/sh + +echo $@ + +[ -z "$(echo $@ | grep "\-l")" ] && str="a-z A-Z" || [ -z "$(echo $@ | grep "\-u")" ] && str="A-Z a-z" || (echo "cs: missing operand" && exit) +[ -z "$(echo $@ | sed 's/\-l//g;s/\-u//g')" ] && words=$(< /dev/stdin) || words="$(echo $@ | sed 's/\-l//g;s/\-u//g')" + +echo $words | tr $str + diff --git a/.local/bin/html2pdf b/.local/bin/html2pdf deleted file mode 120000 index aae33e2..0000000 --- a/.local/bin/html2pdf +++ /dev/null @@ -1 +0,0 @@ -/Users/jmm/Documents/Projects/Experiments/html2pdf/convert.sh
\ No newline at end of file diff --git a/.local/bin/internet b/.local/bin/internet index 70e48ec..942eefe 100755 --- a/.local/bin/internet +++ b/.local/bin/internet @@ -2,9 +2,9 @@ [ "$(connmanctl services | grep "Wired" | awk -F' ' '{print $2}')" = "Wired" ] && CONNECTION="Wired" || CONNECTION="$(connmanctl services | grep '*' | awk -F' ' '{print $2}')" -[ "$CONNECTION" = "Wired" ] && IP="$(ip address | grep dynamic | grep 192.168.)" || IP="$(ip address | grep wlo | grep 192.168. )" +[ "$CONNECTION" = "Wired" ] && IP="$(ip address | grep eth0 | grep 192.168.)" || IP="$(ip address | grep wlo | grep 192.168. )" IP="${IP%/*}" IP="${IP##* }" -printf $CONNECTION +echo $CONNECTION $IP diff --git a/.local/bin/lfub b/.local/bin/lfub new file mode 100755 index 0000000..9012f50 --- /dev/null +++ b/.local/bin/lfub @@ -0,0 +1,24 @@ +#!/bin/sh + +# This is a wrapper script for lb that allows it to create image previews with +# ueberzug. This works in concert with the lf configuration file and the +# lf-cleaner script. + +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 <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup HUP INT QUIT TERM PWR EXIT + lf "$@" 3>&- +fi diff --git a/.local/bin/lower b/.local/bin/lower deleted file mode 100755 index 3c651f5..0000000 --- a/.local/bin/lower +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/local/bin/python3 -while True: - userIn = input("> ").lower() - if userIn == "exit": break - print(userIn) diff --git a/.local/bin/macname b/.local/bin/macname deleted file mode 100755 index cc7fcc9..0000000 --- a/.local/bin/macname +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -name=$1 - -sudo scutil --set ComputerName $name && -sudo scutil --set HostName $name && -sudo scutil --set LocalHostName $name && -echo Done diff --git a/.local/bin/mismatch b/.local/bin/mismatch new file mode 100755 index 0000000..2987b2f --- /dev/null +++ b/.local/bin/mismatch @@ -0,0 +1,12 @@ +#!/bin/sh + +DICTFILE=/usr/share/dict/words + +[ -z $1 ] && words=$(< /dev/stdin) || words=$1 + +for word in $words +do + echo "Word: $word" + [ -z "$(grep -i "\b$word\b" $DICTFILE)" ] && echo $word +done + diff --git a/.local/bin/mkwords b/.local/bin/mkwords new file mode 100755 index 0000000..91a751d --- /dev/null +++ b/.local/bin/mkwords @@ -0,0 +1,5 @@ +#!/bin/sh + +[ -z "$1" ] && words="$(< /dev/stdin)" || words=$1 +echo $words | sed "s/ /\n/g" + diff --git a/.local/bin/rotdir b/.local/bin/rotdir new file mode 100755 index 0000000..86da6db --- /dev/null +++ b/.local/bin/rotdir @@ -0,0 +1,12 @@ +#!/bin/sh + +# When I open an image from the file manager in sxiv (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 sxiv 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/upper b/.local/bin/upper deleted file mode 100755 index e3d8d45..0000000 --- a/.local/bin/upper +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/local/bin/python3 -while True: - userIn = input("> ").upper() - if userIn == "EXIT": break - print(userIn) diff --git a/.local/bin/weather b/.local/bin/weather index a52a855..664b0b1 100755 --- a/.local/bin/weather +++ b/.local/bin/weather @@ -4,7 +4,7 @@ getforecast() { ping -q -c 1 1.1.1.1 >/dev/null || exit 1 curl -sf "wttr.in/Ocean+City" > "$HOME/.cache/weatherreport" || exit 1 ;} showweather() { printf "%s" "$(sed '16q;d' "$HOME/.cache/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" -sed '13q;d' "$HOME/.cache/weatherreport" | grep -o "m\\(-+\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print "❄️",$1 "°","🌞",$2 "°"}' ;} +sed '13q;d' "$HOME/.cache/weatherreport" | grep -o "m\\(-+\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄",$1 "°","🌞",$2 "°"}' ;} [ "$(stat -c %y "$HOME/.cache/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && getforecast showweather |
