diff --git a/.config/bspwm/bspwm/bspwmrc b/.config/bspwm/bspwm/bspwmrc index c0f45d15..f0d48091 100755 --- a/.config/bspwm/bspwm/bspwmrc +++ b/.config/bspwm/bspwm/bspwmrc @@ -18,7 +18,7 @@ mainmonitor="$(bspc query --monitors --names | grep -v LVDS | head -n 1)" # fi # Start workspaces on the main monitor. -bspc monitor $mainmonitor -d 1 2 3 4 5 6 7 8 9 10 +bspc monitor "$mainmonitor" -d 1 2 3 4 5 6 7 8 9 10 bspc desktop -f 1 # If you want a multi-monitor display or something else, I leave that to you to @@ -32,7 +32,7 @@ bspc config focus_follows_pointer true bspc rule -a Zathura state=tiled dropdownname="dropdown" -bspc query -N -n .hidden >/dev/null || setsid $TERMINAL -n "$dropdownname" -e dropdown >/dev/null 2>&1 & +bspc query -N -n .hidden >/dev/null || setsid -f "$TERMINAL" -n "$dropdownname" -e dropdown >/dev/null 2>&1 bspc rule -a St:$dropdownname hidden=on bspc rule -a St:$dropdownname sticky=on bspc rule -a St:$dropdownname state=floating diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc index 1a4c639a..36b9abcc 100755 --- a/.config/bspwm/bspwmrc +++ b/.config/bspwm/bspwmrc @@ -13,7 +13,7 @@ if ! echo "$mainmonitor" | grep LVDS >/dev/null 2>&1; then fi # Start workspaces on the main monitor. -bspc monitor $mainmonitor -d 1 2 3 4 5 6 7 8 9 10 +bspc monitor "$mainmonitor" -d 1 2 3 4 5 6 7 8 9 10 bspc desktop -f 1 # If you want a multi-monitor display or something else, I leave that to you to @@ -26,7 +26,7 @@ bspc config top_padding 24 # top_padding I set equal to polybar's height bspc config focus_follows_pointer true dropdownname="dropdown" -bspc query -N -n .hidden >/dev/null || setsid $TERMINAL -n "$dropdownname" -e dropdown >/dev/null 2>&1 & +bspc query -N -n .hidden >/dev/null || setsid -f "$TERMINAL" -n "$dropdownname" -e dropdown >/dev/null 2>&1 bspc rule -a St:$dropdownname hidden=on bspc rule -a St:$dropdownname sticky=on bspc rule -a St:$dropdownname state=floating diff --git a/.config/directories b/.config/directories index 879219c8..5e8173f2 100644 --- a/.config/directories +++ b/.config/directories @@ -1,11 +1,11 @@ # You can add comments to these files with # -h ~/ -d ~/Documents -D ~/Downloads -m ~/Music -pp ~/Pictures -vv ~/Videos -cf ${XDG_CONFIG_HOME:-$HOME/.config} -cac ${XDG_CACHE_HOME:-$HOME/.cache} -sc ~/.local/bin -mn /mnt +cac ${XDG_CACHE_HOME:-$HOME/.cache} +cf ${XDG_CONFIG_HOME:-$HOME/.config} +D ${XDG_DOWNLOAD_DIR:-$HOME/Downloads} +d ${XDG_DOCUMENTS_DIR:-$HOME/Documents} +h ${XDG_CONFIG_HOME:-$HOME} +m ${XDG_MUSIC_DIR:-$HOME/Music} +mn /mnt +pp ${XDG_PICTURES_DIR:-$HOME/Pictures} +sc ~/.local/bin +vv ${XDG_VIDEOS_DIR:-$HOME/Videos} \ No newline at end of file diff --git a/.config/files b/.config/files index 235762fe..ac69a3ba 100644 --- a/.config/files +++ b/.config/files @@ -14,3 +14,4 @@ cfmc ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/config cfk ${XDG_CONFIG_HOME:-$HOME/.config}/sxhkd/sxhkdrc cfi ${XDG_CONFIG_HOME:-$HOME/.config}/i3/config cfb ${XDG_CONFIG_HOME:-$HOME/.config}/i3blocks/config +cff ${XDG_CONFIG_HOME:-$HOME/.config}/fontconfig/fonts.conf diff --git a/.config/i3/config b/.config/i3/config index ed7e7a59..5553699c 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -62,7 +62,7 @@ bindsym $mod+grave exec --no-startup-id dmenuunicode bindsym $mod+Shift+Delete exec --no-startup-id pulsemixer --mute ; exec --no-startup-id mpc pause && pkill -RTMIN+10 i3blocks ; exec --no-startup-id pauseallmpv; workspace 0; exec $term -e htop ; exec $term -e lf # Show selection: -bindsym $mod+Insert exec --no-startup-id showclip +bindsym $mod+Insert exec --no-startup-id notify-send "📋 Clipboard contents:" "$(xclip -o -selection clipboard)" ##bindsym $mod+Pause # #---Letter Key Bindings---# # diff --git a/.config/lf/lfrc b/.config/lf/lfrc index e3c72730..f7f94105 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -15,15 +15,14 @@ $lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope" # cmds/functions cmd open ${{ case $(file --mime-type $f -b) in - image/vnd.djvu|application/pdf|application/octet-stream) setsid zathura $fx >/dev/null 2>&1 & ;; - text/troff) man ./ $f;; + image/vnd.djvu|application/pdf|application/octet-stream) setsid -f zathura $fx >/dev/null 2>&1 ;; text/*) $EDITOR $fx;; - image/x-xcf|image/svg+xml) setsid gimp $f >/dev/null 2>&1 & ;; - image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\)\(_large\)*$" | setsid sxiv -aio 2>/dev/null | lf-select & ;; - audio/*) mpv $f ;; - video/*) setsid mpv $f -quiet >/dev/null 2>&1 & ;; - application/pdf) setsid zathura $fx >/dev/null 2>&1 & ;; - *) for f in $fx; do setsid $OPENER $f >/dev/null 2>&1 & done;; + image/x-xcf|image/svg+xml) setsid -f gimp $f >/dev/null 2>&1 ;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\)\(_large\)*$" | sxiv -aio 2>/dev/null | lf-select ;; + audio/*) mpv --audio-display=no $f ;; + video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; + *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; esac }} @@ -42,8 +41,10 @@ cmd moveto ${{ clear; tput cup $(($(tput lines)/3)); tput bold set -f clear; echo "Move to where?" - dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" && - eval mv -iv $fx $dest && + dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | 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." }} @@ -51,8 +52,10 @@ cmd copyto ${{ clear; tput cup $(($(tput lines)/3)); tput bold set -f clear; echo "Copy to where?" - dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" && - eval cp -ivr $fx $dest && + dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | 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." }} diff --git a/.config/newsboat/config b/.config/newsboat/config index 3da9b5ea..6bb7d527 100644 --- a/.config/newsboat/config +++ b/.config/newsboat/config @@ -31,11 +31,11 @@ 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 youtube-dl --add-metadata -xic -f bestaudio/best"; open-in-browser ; set browser linkhandler -macro v set browser "setsid nohup mpv"; open-in-browser ; set browser linkhandler -macro w set browser "lynx"; open-in-browser ; set browser linkhandler -macro p set browser "dmenuhandler"; open-in-browser ; set browser linkhandler +macro t set browser "qndl" ; open-in-browser ; set browser linkhandler +macro a set browser "tsp youtube-dl --add-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 p set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler macro c set browser "xsel -b <<<" ; open-in-browser ; set browser linkhandler highlight all "---.*---" yellow diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 48635a4a..b3f40c99 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -103,7 +103,7 @@ set clipboard+=unnamedplus " Save file as sudo on files that require root permission cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! -" Enable Goyo by default for mutt writting +" Enable Goyo by default for mutt writing autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80 autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo | set bg=light autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x! diff --git a/.config/ranger/rifle.conf b/.config/ranger/rifle.conf index 8f661b2a..c6a65491 100644 --- a/.config/ranger/rifle.conf +++ b/.config/ranger/rifle.conf @@ -37,7 +37,7 @@ # # Flags are single characters which slightly transform the command: # f | Fork the program, make it run in the background. -# | New command = setsid $command >& /dev/null & +# | New command = setsid -f $command >& /dev/null # r | Execute the command with root permissions # | New command = sudo $command # t | Run the program in a new terminal. If $TERMCMD is not defined, diff --git a/.config/ranger/scope.sh b/.config/ranger/scope.sh index cce86cf9..174ba17c 100755 --- a/.config/ranger/scope.sh +++ b/.config/ranger/scope.sh @@ -88,9 +88,9 @@ case "$extension" in try odt2txt "$path" && { dump | trim; exit 5; } || exit 1;; # HTML Pages: htm|html|xhtml) - try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } - try lynx -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } - try elinks -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } + try w3m -dump "$path" && { dump | trim | fmt -s -w "$width"; exit 4; } + try lynx -dump "$path" && { dump | trim | fmt -s -w "$width"; exit 4; } + try elinks -dump "$path" && { dump | trim | fmt -s -w "$width"; exit 4; } ;; # fall back to highlight/cat if the text browsers fail esac diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 1f37d24f..1b893724 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -25,9 +25,9 @@ super + c super + v $TERMINAL -e nvim -c VimwikiIndex super + shift + a - $TERMINAL -e alsamixer; pkill -RTMIN+10 blocks + $TERMINAL -e pulsemixer super + shift + c - mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --title='mpvfloat' /dev/video0 + camtoggle super + shift + e tutorialvids super + w diff --git a/.config/wall.png b/.config/wall.png deleted file mode 100644 index 6e9889cc..00000000 Binary files a/.config/wall.png and /dev/null differ diff --git a/.local/bin/booksplit b/.local/bin/booksplit index 95f9e6fd..7730ac23 100755 --- a/.local/bin/booksplit +++ b/.local/bin/booksplit @@ -41,6 +41,6 @@ do done < "$2" # The last track must be done outside the loop. echo "From $start to the end: $title" -file="$escbook/$track-$esctitle.$ext" -echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -ss "$start" -i "$inputaudio" -vn -c copy "$file" && -echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file" +file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext" +echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn -c copy "$file" && + echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file" \ No newline at end of file diff --git a/.local/bin/camtoggle b/.local/bin/camtoggle new file mode 100755 index 00000000..05679c0c --- /dev/null +++ b/.local/bin/camtoggle @@ -0,0 +1,2 @@ +#!/bin/sh +pkill -f /dev/video || mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=30% --title="mpvfloat" /dev/video0 diff --git a/.local/bin/compiler b/.local/bin/compiler index 51d14f5e..1892d5fb 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -5,10 +5,14 @@ # # Compiles .tex. groff (.mom, .ms), .rmd, .md. Opens .sent files as sent # presentations. Runs scripts based on extention or shebang +# +# Note that .tex files which you wish to compile with XeLaTeX should have the +# string "xelatex" somewhere in a comment/command in the first 5 lines. file=$(readlink -f "$1") -dir=$(dirname "$file") +dir=${file%/*} base="${file%.*}" +ext="${file##*.}" cd "$dir" || exit @@ -22,19 +26,27 @@ textype() { \ $command --output-directory="$dir" "$base" } -case "$file" in - *\.ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;; - *\.mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; - *\.[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; - *\.[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; - *\.tex) textype "$file" ;; - *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; - *config.h) sudo make install ;; - *\.c) cc "$file" -o "$base" && "$base" ;; - *\.py) python "$file" ;; - *\.m) octave "$file" ;; - *\.scad) openscad -o "$base".stl "$file" ;; - *\.go) go run "$file" ;; - *\.sent) setsid sent "$file" 2>/dev/null & ;; +case "$ext" in + [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; + c) cc "$file" -o "$base" && "$base" ;; + go) go run "$file" ;; + h) sudo make install ;; + m) octave "$file" ;; + md) if [ -x "$(command -v lowdown)" ]; then + lowdown -d nointem -e super "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf + elif [ -x "$(command -v groffdown)" ]; then + groffdown -i "$file" | groff > "$base.pdf" + else + pandoc "$file" --pdf-engine=xelatex -o "$base".pdf + fi ; ;; + mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; + ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;; + py) python "$file" ;; + [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; + rs) cargo build ;; + sass) sassc -a "$file" "$base.css" ;; + scad) openscad -o "$base".stl "$file" ;; + sent) setsid -f sent "$file" 2>/dev/null ;; + tex) textype "$file" ;; *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; esac diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup index 34ed61e3..bf7f85d6 100755 --- a/.local/bin/cron/checkup +++ b/.local/bin/cron/checkup @@ -2,7 +2,7 @@ # Syncs repositories and downloads updates, meant to be run as a cronjob. -ping -q -c 1 1.1.1.1 > /dev/null || exit +ping -q -c example.org > /dev/null || exit notify-send "📦 Repository Sync" "Checking for package updates..." diff --git a/.local/bin/cron/crontog b/.local/bin/cron/crontog index 8168012e..5aba5e65 100755 --- a/.local/bin/cron/crontog +++ b/.local/bin/cron/crontog @@ -3,4 +3,4 @@ # Toggles all cronjobs off/on. # Stores disabled crontabs in ~/.consaved until restored. -([ -f ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved ] && crontab - < ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && rm ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.") +([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.") diff --git a/.local/bin/cron/newsup b/.local/bin/cron/newsup index bf8898ea..29f2b3c9 100755 --- a/.local/bin/cron/newsup +++ b/.local/bin/cron/newsup @@ -3,11 +3,11 @@ # Set as a cron job to check for new RSS entries for newsboat. # If newsboat is open, sends it an "R" key to refresh. -ping -q -c 1 1.1.1.1 > /dev/null || exit +ping -q -c 1 example.org > /dev/null || exit /usr/bin/notify-send "📰 Updating RSS feeds..." -ps ax | grep -q newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit +pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit echo 🔃 > /tmp/newsupdate pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}" diff --git a/.local/bin/displayselect b/.local/bin/displayselect index 57120ec2..37d1397a 100755 --- a/.local/bin/displayselect +++ b/.local/bin/displayselect @@ -18,10 +18,10 @@ twoscreen() { # If multi-monitor is selected and there are two screens. res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \ tail -n 1 | awk '{print $1}') - res_ext_x=$(echo $res_external | sed 's/x.*//') - res_ext_y=$(echo $res_external | sed 's/.*x//') - res_int_x=$(echo $res_internal | sed 's/x.*//') - res_int_y=$(echo $res_internal | sed 's/.*x//') + res_ext_x=$(echo "$res_external" | sed 's/x.*//') + res_ext_y=$(echo "$res_external" | sed 's/.*x//') + res_int_x=$(echo "$res_internal" | sed 's/x.*//') + res_int_y=$(echo "$res_internal" | sed 's/.*x//') scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l) scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l) @@ -59,7 +59,7 @@ onescreen() { # If only one output available or chosen. postrun() { # Stuff to run to clean up. setbg # Fix background if screen size/arangement has changed. remaps # Re-remap keys if keyboard added (for laptop bases) - { killall dunst ; setsid dunst & } >/dev/null 2>&1 # Restart dunst to ensure proper location on screen + { killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen } # Get all possible displays diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler index 8ada2f42..5bdd1314 100755 --- a/.local/bin/dmenuhandler +++ b/.local/bin/dmenuhandler @@ -5,12 +5,12 @@ case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in "copy url") echo "$1" | xclip -selection clipboard ;; - mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; - "mpv (loop)") setsid mpv -quiet --loop "$1" >/dev/null 2>&1 & ;; + mpv) setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;; + "mpv (loop)") setsid -f mpv -quiet --loop "$1" >/dev/null 2>&1 ;; "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; - browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;; - feh) setsid feh "$1" >/dev/null 2>&1 & ;; + browser) setsid -f "$BROWSER" "$1" >/dev/null 2>&1 ;; + feh) setsid -f feh "$1" >/dev/null 2>&1 ;; w3m) w3m "$1" >/dev/null 2>&1 ;; - "mpv (float)") setsid mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;; + "mpv (float)") setsid -f mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 ;; esac diff --git a/.local/bin/dmenumount b/.local/bin/dmenumount index 75e11b55..488522a6 100755 --- a/.local/bin/dmenumount +++ b/.local/bin/dmenumount @@ -49,7 +49,7 @@ asktype() { \ } anddrives=$(simple-mtpfs -l 2>/dev/null) -usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$4==""{printf "%s (%s)\n",$1,$3}')" +usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')" if [ -z "$usbdrives" ]; then [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit diff --git a/.local/bin/dmenumountcifs b/.local/bin/dmenumountcifs new file mode 100755 index 00000000..3be6e863 --- /dev/null +++ b/.local/bin/dmenumountcifs @@ -0,0 +1,19 @@ +#!/bin/sh +# Gives a dmenu prompt to mount unmounted local NAS shares. +# Requirements - "%wheel ALL=(ALL) NOPASSWD: ALL" +# +# Browse for mDNS/DNS-SD services using the Avahi daemon... +srvname=$(avahi-browse _smb._tcp -t | awk '{print $4}' | dmenu -i -p "Which NAS?") || exit 1 +notify-send "Searching for network shares..." "Please wait..." +# Choose share disk... +share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p "Mount which share?") || exit 1 +# Format URL... +share2mnt=//"$srvname".local/"$share" + +sharemount() { + mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && mkdir /mnt/"$share") + [ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="" /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0 + notify-send "Netshare $share already mounted"; exit 1 +} + +sharemount diff --git a/.local/bin/getbib b/.local/bin/getbib new file mode 100755 index 00000000..ed441c56 --- /dev/null +++ b/.local/bin/getbib @@ -0,0 +1,14 @@ +#!/bin/sh +[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit + +if [ -f "$1" ]; then + # Try to get DOI from pdfinfo or pdftotext output. + doi=$(pdfinfo "$1" | grep -io "doi:.*") || + doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) || + exit 1 +else + doi="$1" +fi + +# Check crossref.org for the bib citation. +curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n" diff --git a/.local/bin/getkeys b/.local/bin/getkeys index 0a0e86e1..266f29a6 100755 --- a/.local/bin/getkeys +++ b/.local/bin/getkeys @@ -1,5 +1,5 @@ #!/bin/sh -cat ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys/"$1" 2>/dev/null && exit +cat "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys/"$1" 2>/dev/null && exit echo "Run command with one of the following arguments for info about that program:" -ls ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys +ls "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys diff --git a/.local/bin/ifinstalled b/.local/bin/ifinstalled index 04c0eef4..e2013a46 100755 --- a/.local/bin/ifinstalled +++ b/.local/bin/ifinstalled @@ -5,4 +5,7 @@ # it informs the user that they need that command to continue. This is used in # various other scripts for clarity's sake. -pacman -Qq "$1" >/dev/null || { notify-send "📦 $1" "must be installed for this function." && exit 1 ;} +for x in "$@";do + pacman -Qq "$x" 2>/dev/null || + { notify-send "📦 $x" "must be installed for this function." && exit 1 ;} +done diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler index 06600115..7c7e96f7 100755 --- a/.local/bin/linkhandler +++ b/.local/bin/linkhandler @@ -11,12 +11,12 @@ case "$1" in *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*) - setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; + setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;; *png|*jpg|*jpe|*jpeg|*gif) curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; *mp3|*flac|*opus|*mp3?source*) - setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;; + setsid -f tsp curl -LO "$1" >/dev/null 2>&1 ;; *) - if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1" - else setsid $BROWSER "$1" >/dev/null 2>&1 & fi ;; + if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR" "$1" + else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi ;; esac diff --git a/.local/bin/lmc b/.local/bin/lmc deleted file mode 100755 index d4314952..00000000 --- a/.local/bin/lmc +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -NUM="${2:-5}" - -# Uncomment the following line to use Pulseaudio. -# PULSE=true - -if [ "$PULSE" ]; then - toggle() { pulsemixer --toggle-mute ;} - mute() { pulsemixer --mute ;} - up() { pulsemixer --change-volume +"$NUM" ;} - down() { pulsemixer --change-volume -"$NUM" ;} - control() { pulsemixer ;} -else - toggle() { amixer sset Master toggle ;} - mute() { amixer sset Master mute ;} - up() { amixer sset Master "$NUM"%+ ;} - down() { amixer sset Master "$NUM"%- ;} - control() { alsamixer ;} -fi - -case "$1" in - toggle) toggle ;; - mute) mute ;; - up) up ;; - down) down ;; - control) control ;; -esac diff --git a/.local/bin/opout b/.local/bin/opout index 28af763a..7f452df0 100755 --- a/.local/bin/opout +++ b/.local/bin/opout @@ -4,10 +4,10 @@ # usually the pdf of a compiled document. I find this useful especially # running from vim. -basename="$(echo "$1" | sed 's/\.[^\/.]*$//')" +basename="$(echo "${*}" | sed 's/\.[^\/.]*$//')" -case "$1" in - *.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid xdg-open "$basename".pdf >/dev/null 2>&1 & ;; - *.html) setsid "$BROWSER" "$basename".html >/dev/null 2>&1 & ;; - *.sent) setsid sent "$1" >/dev/null 2>&1 & ;; +case "${*}" in + *.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;; + *.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;; + *.sent) setsid -f sent "$1" >/dev/null 2>&1 ;; esac diff --git a/.local/bin/pauseallmpv b/.local/bin/pauseallmpv index 15b9f599..d69a4146 100755 --- a/.local/bin/pauseallmpv +++ b/.local/bin/pauseallmpv @@ -6,5 +6,5 @@ # (with other things) by default and is used in some other places. for i in $(ls /tmp/mpvSockets/*); do - echo '{ "command": ["set_property", "pause", true] }' | socat - $i; + echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"; done diff --git a/.local/bin/podentr b/.local/bin/podentr index 9a8313ab..9454b07f 100755 --- a/.local/bin/podentr +++ b/.local/bin/podentr @@ -2,6 +2,6 @@ # entr command to run `queueandnotify` when newsboat queue is changed -[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit +[ "$(pgrep -x "$(basename "$0")" | wc -l)" -gt 2 ] && exit -echo ${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue | entr -p queueandnotify 2>/dev/null +echo "${XDG_DATA_HOME:-$HOME/.local/share}"/newsboat/queue | entr -p queueandnotify 2>/dev/null diff --git a/.local/bin/qndl b/.local/bin/qndl index f5bd14f2..2236c66d 100755 --- a/.local/bin/qndl +++ b/.local/bin/qndl @@ -6,7 +6,7 @@ base="$(basename "$1")" notify-send "⏳ Queuing $base..." cmd="$2" [ -z "$cmd" ] && cmd="youtube-dl --add-metadata" -idnum="$(tsp $cmd "$1")" +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/shortcuts b/.local/bin/shortcuts index 19d3ffd4..ed4f89f9 100755 --- a/.local/bin/shortcuts +++ b/.local/bin/shortcuts @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Output locations. Unactivated progs should go to /dev/null. shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc" @@ -6,7 +6,7 @@ zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" ranger_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/ranger/shortcuts.conf" qute_shortcuts="/dev/null" fish_shortcuts="/dev/null" -vifm_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/vifm/vifmshortcuts" +vifm_shortcuts="/dev/null" # Remove, prepare files rm -f "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" 2>/dev/null @@ -15,15 +15,17 @@ printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts" printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" # Format the `directories` file in the correct syntax and sent it to all three configs. -sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/directories" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ - >(awk '{print "hash -d "$1"="$2}' >> "$zsh_named_dirs") \ - >(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \ - >(awk '{print "map g" $1, ":cd", $2 "\nmap t" $1, ":cd", $2 "\nmap M" $1, ":cd", $2 ":mo\nmap Y" $1, ":cd", $2 ":co" }' >> "$vifm_shortcuts") \ - >(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \ - | awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts" +awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); + printf(\"%s=\42cd %s && ls -a\42 \\\\\n\",\$1,\$2) >> \"$shell_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\nmap t%s :cd %s\nmap M%s :cd %s:mo\nmap Y%s :cd %s:co \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 g%s cd %s\nmap t%s tab_new %s\nmap m%s shell mv -v %%s %s\nmap Y%s shell cp -rv %%s %s \n\",\$1,\$2,\$1,\$2, \$1, \$2, \$1, \$2) >> \"$ranger_shortcuts\" }" "${XDG_CONFIG_HOME:-$HOME/.config}/directories" # Format the `files` file in the correct syntax and sent it to both configs. -sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/files" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ - >(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \ - >(awk '{print "map", $1, ":e", $2 "" }' >> "$vifm_shortcuts") \ - | awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts" +awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); + printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; + printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\" ; + printf(\"map %s :e %s \n\",\$1,\$2) >> \"$vifm_shortcuts\" ; + printf(\"map %s shell \$EDITOR %s \n\",\$1,\$2) >> \"$ranger_shortcuts\" }" "${XDG_CONFIG_HOME:-$HOME/.config}/files" diff --git a/.local/bin/showclip b/.local/bin/showclip deleted file mode 100755 index d2faff8b..00000000 --- a/.local/bin/showclip +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Display contents of selection via dunst if running. -# Separate script for i3. - -clip=$(xclip -o -selection clipboard) -prim=$(xclip -o -selection primary) - -[ -n "$clip" ] && notify-send "Clipboard:" "$clip" -[ -n "$prim" ] && notify-send "Primary:" "$prim" diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery index a6fb62d1..35365347 100755 --- a/.local/bin/statusbar/battery +++ b/.local/bin/statusbar/battery @@ -20,7 +20,7 @@ esac for battery in /sys/class/power_supply/BAT? do # Get its remaining capacity and charge status. - capacity=$(cat "$battery"/capacity) || break + capacity=$(cat "$battery"/capacity 2>/dev/null) || break status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/⚡/" "$battery"/status) # If it is discharging and 25% or less, we will add a ❗ as a warning. diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock index 431a7f09..af501170 100755 --- a/.local/bin/statusbar/clock +++ b/.local/bin/statusbar/clock @@ -20,7 +20,7 @@ esac case $BLOCK_BUTTON in 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;; - 2) setsid "$TERMINAL" -e calcurse -D ~/.config/calcurse & ;; + 2) setsid -f "$TERMINAL" -e calcurse ;; 3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` - Middle click opens calcurse if installed" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; diff --git a/.local/bin/statusbar/cpu b/.local/bin/statusbar/cpu index 9225c1e8..1572b527 100755 --- a/.local/bin/statusbar/cpu +++ b/.local/bin/statusbar/cpu @@ -2,7 +2,7 @@ case $BLOCK_BUTTON in 1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; - 2) setsid "$TERMINAL" -e htop & ;; + 2) setsid -f "$TERMINAL" -e htop ;; 3) notify-send "🖥 CPU module " "\- Shows CPU temperature. - Click to show intensive processes. - Middle click to open htop." ;; diff --git a/.local/bin/statusbar/cpubars b/.local/bin/statusbar/cpubars new file mode 100755 index 00000000..297424e7 --- /dev/null +++ b/.local/bin/statusbar/cpubars @@ -0,0 +1,44 @@ +#!/bin/sh + +# Module showing CPU load as a changing bars. +# Just like in polybar. +# Each bar represents amount of load on one core since +# last run. + +# Cache in tmpfs to improve speed and reduce SSD load +cache=/tmp/cpubarscache + +case $BLOCK_BUTTON in + 2) setsid -f "$TERMINAL" -e htop ;; + 3) notify-send "🪨 CPU load module" "Each bar represents +one CPU core";; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +# id total idle +stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) +[ ! -f $cache ] && echo "$stats" > "$cache" +old=$(cat "$cache") +printf "🪨" +echo "$stats" | while read -r row; do + id=${row%% *} + rest=${row#* } + total=${rest%% *} + idle=${rest##* } + + case "$(echo "$old" | awk '{if ($1 == id) + printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \ + id="$id" total="$total" idle="$idle")" in + + "0") printf "▁";; + "1") printf "▂";; + "2") printf "▃";; + "3") printf "▄";; + "4") printf "▅";; + "5") printf "▆";; + "6") printf "▇";; + "7") printf "█";; + "8") printf "█";; + esac +done; printf "\\n" +echo "$stats" > "$cache" diff --git a/.local/bin/statusbar/crypto b/.local/bin/statusbar/crypto index bb19fc94..94ed9496 100755 --- a/.local/bin/statusbar/crypto +++ b/.local/bin/statusbar/crypto @@ -28,7 +28,7 @@ printprices() { # Print/format all prices for x in "$dir"/*; do [ -f "$x" ] || break info="$(cut -d';' -f-2 --output-delimiter=' ' "$x")" - printf "%s$%0.2f " $info + printf "%s$%0.2f " "$info" done | sed 's/ $/\n/' } @@ -36,7 +36,7 @@ printprices() { # Print/format all prices # If currencies haven't been updated today, try to update them. [ "$(stat -c %x "$HOME/.local/share/crypto-prices" | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && - { ping -q -c 1 1.1.1.1 >/dev/null 2>&1 && getprices || exit ;} + { ping -q -c 1 example.org >/dev/null 2>&1 && getprices || exit ;} case $BLOCK_BUTTON in 1) uptime="$(date -d "$(stat -c %x "$dir")" '+%D at %T' | sed "s|$(date '+%D')|Today|")" diff --git a/.local/bin/statusbar/help-icon b/.local/bin/statusbar/help-icon index 9c90964a..8fa4a52c 100755 --- a/.local/bin/statusbar/help-icon +++ b/.local/bin/statusbar/help-icon @@ -3,7 +3,7 @@ # The clickable help menu. Middle click to restart wm. # If dwm is running, use dwm's readme and restart. -ps ax | grep -q "\sdwm$" && +pidof dwm >/dev/null && READMEFILE=/usr/local/share/dwm/larbs.mom restartwm() { pkill -HUP dwm ;} || restartwm() { i3 restart ;} diff --git a/.local/bin/statusbar/kbselect b/.local/bin/statusbar/kbselect new file mode 100755 index 00000000..d7313c65 --- /dev/null +++ b/.local/bin/statusbar/kbselect @@ -0,0 +1,16 @@ +#!/bin/sh +# works on any init system +# requirements: dmenu, xorg-setxkbmap, xkblayout-state (https://github.com/nonpop/xkblayout-state) +kb="$(xkblayout-state print "%s")" || exit 1 + +case $BLOCK_BUTTON in + 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)" + kb="$(echo "$kb_choice" | awk '{print $3}')" + setxkbmap "$kb" + pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";; + 3) notify-send "⌨ Keyboard/language module" "$(xkblayout-state print "\- Current layout: %s (%n)") +- Left click to change keyboard.";; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +echo "$kb" diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox index 8f87d757..ca77f5ca 100755 --- a/.local/bin/statusbar/mailbox +++ b/.local/bin/statusbar/mailbox @@ -4,8 +4,8 @@ # When clicked, brings up `neomutt`. case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e neomutt & ;; - 2) setsid mailsync >/dev/null & ;; + 1) setsid -f "$TERMINAL" -e neomutt ;; + 2) setsid -f mailsync >/dev/null ;; 3) notify-send "📬 Mail module" "\- Shows unread mail - Shows 🔃 if syncing mail - Left click opens neomutt diff --git a/.local/bin/statusbar/memory b/.local/bin/statusbar/memory index 07a0f41b..01d3daf9 100755 --- a/.local/bin/statusbar/memory +++ b/.local/bin/statusbar/memory @@ -2,7 +2,7 @@ case $BLOCK_BUTTON in 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; - 2) setsid "$TERMINAL" -e htop & ;; + 2) setsid -f "$TERMINAL" -e htop ;; 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. - Click to show memory hogs. - Middle click to open htop." ;; diff --git a/.local/bin/statusbar/music b/.local/bin/statusbar/music index 54eced50..8de3e6ae 100755 --- a/.local/bin/statusbar/music +++ b/.local/bin/statusbar/music @@ -2,13 +2,13 @@ filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d" | paste -sd ' ';} -pidof -x mpdup >/dev/null 2>&1 || mpdup & +pidof -x mpdup >/dev/null 2>&1 || mpdup >/dev/null 2>&1 & case $BLOCK_BUTTON in - 1) mpc status | filter ; setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause + 1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # right click, pause/unpause 2) mpc toggle | filter ;; # right click, pause/unpause 3) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing. -- Italic when paused. +- ⏸ when paused. - Left click opens ncmpcpp. - Middle click pauses. - Scroll changes track.";; # right click, pause/unpause diff --git a/.local/bin/statusbar/nettraf b/.local/bin/statusbar/nettraf index 3c41dfc7..71e6fe43 100755 --- a/.local/bin/statusbar/nettraf +++ b/.local/bin/statusbar/nettraf @@ -4,22 +4,25 @@ # transmitted (TX) since the previous time this script ran. So if run every # second, gives network traffic per second. -case "$BLOCK_BUTTON" in +case $BLOCK_BUTTON in 3) notify-send "🌐 Network traffic module" "🔻: Traffic received 🔺: Traffic transmitted" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -rxfile="${XDG_CACHE_HOME:-$HOME/.cache}/rxlog" -txfile="${XDG_CACHE_HOME:-$HOME/.cache}/txlog" +update() { + sum=0 + for arg; do + read -r i < "$arg" + sum=$(( sum + i )) + done + cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/} + [ -f "$cache" ] && read -r old < "$cache" || old=0 + printf %d\\n "$sum" > "$cache" + printf %d\\n $(( sum - old )) +} -rxcurrent="$(cat /sys/class/net/*/statistics/rx_bytes | paste -sd '+' | bc)" -txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+' | bc)" +rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) +tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) -printf "🔻%sKiB 🔺%sKiB\\n" \ - "$(printf -- "(%s-%s)/1024\\n" "$rxcurrent" "$(cat "$rxfile")" | bc)" \ - "$(printf -- "(%s-%s)/1024\\n" "$txcurrent" "$(cat "$txfile")" | bc)" - -# Log the current values for next run. -echo "$rxcurrent" > "$rxfile" -echo "$txcurrent" > "$txfile" +printf "🔻%4sB 🔺%4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx) diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news index 69d9bf32..fe701db6 100755 --- a/.local/bin/statusbar/news +++ b/.local/bin/statusbar/news @@ -5,7 +5,7 @@ case $BLOCK_BUTTON in 1) setsid "$TERMINAL" -e newsboat ;; - 2) setsid newsup >/dev/null & exit ;; + 2) setsid -f newsup >/dev/null exit ;; 3) notify-send "📰 News module" "\- Shows unread news items - Shows 🔃 if updating with \`newsup\` - Left click opens newsboat @@ -14,4 +14,4 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac - cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print "📰" $1}' | sed 's/^📰 0$//g')$(cat ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/.update 2>/dev/null)" + cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "📰" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)" diff --git a/.local/bin/statusbar/pacpackages b/.local/bin/statusbar/pacpackages index e61660c2..a9b6cf77 100755 --- a/.local/bin/statusbar/pacpackages +++ b/.local/bin/statusbar/pacpackages @@ -18,7 +18,7 @@ # Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3. case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e popupgrade & ;; + 1) setsid -f "$TERMINAL" -e popupgrade ;; 2) notify-send "$(/usr/bin/pacman -Qu)" ;; 3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages - Left click to upgrade packages diff --git a/.local/bin/statusbar/price b/.local/bin/statusbar/price index 953df3b0..45b01adb 100755 --- a/.local/bin/statusbar/price +++ b/.local/bin/statusbar/price @@ -6,23 +6,25 @@ # When the name of the currency is multi-word, put it in quotes. [ -z "$3" ] && exit 1 -interval="@7d" # History contained in chart preceded by '@' (7d = 7 days) +interval="@14d" # History contained in chart preceded by '@' (7d = 7 days) dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices" pricefile="$dir/$1" chartfile="$dir/$1-chart" +updateprice() { ping -q -c 1 example.org >/dev/null 2>&1 && + curl -s "rate.sx/1$1" > "$pricefile" && + curl -s "rate.sx/$1$interval" > "$chartfile" ;} + [ -d "$dir" ] || mkdir -p "$dir" [ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && - { ping -q -c 1 1.1.1.1 >/dev/null 2>&1 && curl -s "rate.sx/1$1" > "$pricefile" || exit ;} - -printf "$3$%0.2f" "$(cat "$pricefile")" - -[ "$(stat -c %x "$chartfile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && - { ping -q -c 1 1.1.1.1 >/dev/null 2>&1 && curl -s "rate.sx/$1$interval" > "$chartfile" || exit ;} + updateprice "$1" case $BLOCK_BUTTON in 1) setsid "$TERMINAL" -e less -Sf "$chartfile" ;; + 2) notify-send -u low "$3 Updating..." "Updating $2 price..." + updateprice "$1" && notify-send "$3 Update complete." "$2 price is now +\$$(cat "$pricefile")" ;; 3) uptime="$(date -d "$(stat -c %x "$pricefile")" '+%D at %T' | sed "s|$(date '+%D')|Today|")" notify-send "$3 $2 module" "\- Exact price: \$$(cat "$pricefile") - Left click for chart of changes. @@ -32,3 +34,5 @@ case $BLOCK_BUTTON in $uptime" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac + +printf "$3$%0.2f" "$(cat "$pricefile")" diff --git a/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent index e9e7fce3..9e1da3a6 100755 --- a/.local/bin/statusbar/torrent +++ b/.local/bin/statusbar/torrent @@ -17,7 +17,7 @@ transmission-remote -l | grep % | s/Z/🌱/g" | awk '{print $2 $1}' | paste -sd ' ' case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e tremc & ;; + 1) setsid -f "$TERMINAL" -e tremc ;; 2) td-toggle ;; 3) notify-send "🌱 Torrent module" "\- Left click to open tremc. - Middle click to toggle transmission. diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume index b64744ff..61588c3f 100755 --- a/.local/bin/statusbar/volume +++ b/.local/bin/statusbar/volume @@ -1,14 +1,9 @@ #!/bin/sh -# Prints the current volume or 🔇 if muted. Uses PulseAudio by default, -# uncomment the ALSA lines if you remove PulseAudio. +# Prints the current volume or 🔇 if muted. case $BLOCK_BUTTON in - # 1) setsid "$TERMINAL" -e alsamixer & ;; - # 2) amixer sset Master toggle ;; - # 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;; - # 5) amixer sset Master 5%- >/dev/null 2>/dev/null ;; - 1) setsid "$TERMINAL" -e pulsemixer & ;; + 1) setsid -f "$TERMINAL" -e pulsemixer ;; 2) pamixer -t ;; 4) pamixer --allow-boost -i 1 ;; 5) pamixer --allow-boost -d 1 ;; @@ -18,14 +13,9 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -volstat="$(pactl list sinks)" -# volstat="$(amixer get Master)" # ALSA only equivalent. +[ $(pamixer --get-mute) = true ] && echo 🔇 && exit -echo "$volstat" | grep -q "Mute: yes" && printf "🔇\\n" && exit -# echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit # ALSA - -vol="$(echo "$volstat" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")" -# vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") # ALSA +vol="$(pamixer --get-volume)" if [ "$vol" -gt "70" ]; then icon="🔊" @@ -35,4 +25,4 @@ else icon="🔉" fi -printf "%s%s%%\\n" "$icon" "$vol" +echo "$icon$vol%" diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/weather index 2599e915..e04bac0b 100755 --- a/.local/bin/statusbar/weather +++ b/.local/bin/statusbar/weather @@ -6,17 +6,18 @@ # If we have internet, get a weather report from wttr.in and store it locally. # You could set up a shell alias to view the full file in a pager in the # terminal if desired. This function will only be run once a day when needed. -getforecast() { curl -sf "wttr.in/$LOCATION" > "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" || exit 1 ;} +weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" +getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} # Some very particular and terse stream manipulation. We get the maximum # precipication chance and the daily high and low from the downloaded file and # display them with coresponding emojis. -showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | +showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔/g;1q" | tr -d '\n')" -sed '13q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/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' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶" $1 "°","🌞" $2 "°"}' ;} case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" & ;; + 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;; 2) getforecast && showweather ;; 3) notify-send "🌈 Weather module" "\- Left click for full forecast. - Middle click to update forecast. @@ -28,7 +29,7 @@ esac # The test if our forcecast is updated to the day. If it isn't download a new # weather report from wttr.in with the above function. -[ "$(stat -c %y "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || +[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || getforecast showweather diff --git a/.local/bin/tutorialvids b/.local/bin/tutorialvids index 5ca5c50f..2ed1542e 100755 --- a/.local/bin/tutorialvids +++ b/.local/bin/tutorialvids @@ -1,12 +1,17 @@ #!/bin/sh +# This gives the user a list of videos they can select and watch without a +# browser. If you want to check a tutorial video, it makes it easy. I'll +# add/remove videos from this list as I go on. + vidlist=" -status bar https://www.youtube.com/watch?v=gKumet6b-WY +dwm (window manager) https://www.youtube.com/watch?v=xnREqY-oyzM +pacman (installing/managing programs) https://www.youtube.com/watch?v=-dEuXTMzRKs +status bar https://www.youtube.com/watch?v=UP2QpHmcgyk sxiv (image viewer) https://www.youtube.com/watch?v=GYW9i_u5PYs st (terminal) https://www.youtube.com/watch?v=9H75enWM22k -i3 (window manager) https://www.youtube.com/watch?v=GKviflL9XeI -pacman (installing/managing programs) https://www.youtube.com/watch?v=-dEuXTMzRKs -mutt (email) https://www.youtube.com/watch?v=2U3vRbF7v5A +i3 (old window manager) https://www.youtube.com/watch?v=GKviflL9XeI +neomutt (email) https://www.youtube.com/watch?v=2U3vRbF7v5A ncmpcpp (music player) https://www.youtube.com/watch?v=sZIEdI9TS2U newsboat (RSS reader) https://www.youtube.com/watch?v=dUFCRqs822w ranger (file manager) https://www.youtube.com/watch?v=L6Vu7WPkoJo diff --git a/.local/share/bg b/.local/share/bg index 6c5d2998..b41641dc 120000 --- a/.local/share/bg +++ b/.local/share/bg @@ -1 +1 @@ -../../.config/wall.png \ No newline at end of file +thiemeyer_road_to_samarkand.jpg \ No newline at end of file diff --git a/.local/share/thiemeyer_road_to_samarkand.jpg b/.local/share/thiemeyer_road_to_samarkand.jpg new file mode 100644 index 00000000..6a30adb2 Binary files /dev/null and b/.local/share/thiemeyer_road_to_samarkand.jpg differ diff --git a/.zprofile b/.zprofile index 840aeecd..53161ed0 100644 --- a/.zprofile +++ b/.zprofile @@ -34,6 +34,8 @@ export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android" export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo" export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go" export ANSIBLE_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/ansible/ansible.cfg" +export UNISON="${XDG_DATA_HOME:-$HOME/.local/share}/unison" +export HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/history" # Other program settings: export DICS="/usr/share/stardict/dic/" @@ -66,11 +68,15 @@ ex=🎯:\ *.me=✍:\ *.ms=✍:\ *.png=🖼:\ +*.webp=🖼:\ *.ico=🖼:\ *.jpg=📸:\ +*.jpe=📸:\ *.jpeg=📸:\ *.gif=🖼:\ *.svg=🗺:\ +*.tif=🖼:\ +*.tiff=🖼:\ *.xcf=🖌:\ *.html=🌎:\ *.xml=📰:\ @@ -87,6 +93,7 @@ ex=🎯:\ *.R=📊:\ *.rmd=📊:\ *.Rmd=📊:\ +*.m=📊:\ *.mp3=🎵:\ *.opus=🎵:\ *.ogg=🎵:\ @@ -104,6 +111,9 @@ ex=🎯:\ *.z64=🎮:\ *.v64=🎮:\ *.n64=🎮:\ +*.gba=🎮:\ +*.nes=🎮:\ +*.gdi=🎮:\ *.1=ℹ:\ *.nfo=ℹ:\ *.info=ℹ:\ @@ -114,6 +124,8 @@ ex=🎯:\ *.ged=👪:\ *.part=💔:\ *.torrent=🔽:\ +*.jar=♨:\ +*.java=♨:\ " [ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ] && shortcuts >/dev/null 2>&1 & diff --git a/FUNDING.yml b/FUNDING.yml new file mode 100644 index 00000000..f8e60767 --- /dev/null +++ b/FUNDING.yml @@ -0,0 +1,3 @@ +github: lukesmithxyz +custom: ["https://lukesmith.xyz/donate", "https://paypal.me/lukemsmith", "https://lukesmith.xyz/crypto"] +patreon: lukesmith diff --git a/README.md b/README.md index 069055d1..4b8b7136 100644 --- a/README.md +++ b/README.md @@ -42,4 +42,4 @@ Use [LARBS](https://larbs.xyz) to autoinstall everything: curl -LO larbs.xyz/larbs.sh ``` -or clone the repo files directly to your home directory and install [the prerequisite programs](https://github.com/LukeSmithxyz/LARBS/blob/master/progs.csv) or [those required for the i3 setup](https://github.com/LukeSmithxyz/LARBS/blob/master/legacy.csv). +or clone the repo files directly to your home directory and install [the prerequisite programs](https://github.com/LukeSmithxyz/LARBS/blob/master/progs.csv).