cleaning up unused scripts

master
tiynger 5 years ago
parent 28d43dc5c5
commit 48d286f39c

@ -60,15 +60,6 @@ set clipboard=unnamedplus
" Replace all is aliased to S.
nnoremap S :%s//g<Left><Left>
" Compile document, be it groff/LaTeX/markdown/etc.
map <leader>c :w! \| !compiler <c-r>%<CR>
" Open corresponding .pdf/.html or preview
map <leader>p :!opout <c-r>%<CR><CR>
" Runs a script that cleans out tex build files whenever I close out of a .tex file.
autocmd VimLeave *.tex !texclear %
" Ensure files are read as what I want:
let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
let g:vimwiki_list = [{'path': '~/vimwiki', 'syntax': 'markdown', 'ext': '.md'}]

@ -1,26 +0,0 @@
#!/bin/bash
# Dependencies are xclip and xorg-xprop.
# qrencode required for qrcode generation.
# groff/zathura required for man pages.
prim="$(xclip -o)"; [ -z "$prim" ] && exit
PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
cd "$(readlink /proc/"$PID"/cwd)"
[ -f "$prim" ] && xdg-open "$prim" && exit
[ -d "$prim" ] && "$TERMINAL" "$prim" && exit
websearch() { "$BROWSER" "https://duckduckgo.com/?q=$@" ;}
wikipedia() { "$BROWSER" "https://en.wikipedia.org/wiki/$@" ;}
wiktionary() { "$BROWSER" "https://en.wiktionary.org/wiki/$@" ;}
maps() { "$BROWSER" "https://www.openstreetmap.org/search?query=$@" ;}
ebay() { "$BROWSER" "https://www.ebay.com/sch/$@" ;}
echo "$prim" | grep "^.*\.[A-Za-z]\+.*" >/dev/null && gotourl() { "$BROWSER" "$@" ;}
echo "$prim" | grep "^.*@.*\.[A-Za-z]\+$" >/dev/null && email() { xdg-email "$@" ;}
command -v qrencode >/dev/null && qrcode() { qrencode "$@" -s 10 -o /tmp/qr.png && xdg-open /tmp/qr.png ;}
man -k "^$prim$" >/dev/null && manual() { man -Tpdf "$prim" | zathura - ;}
func="$(declare -F | awk '{print $3}' | dmenu -p "Plumb \"$(echo "$prim" | cut -c -30)\" to?" -i -l 15)"
[ -z "$func" ] || "$func" "$prim"

@ -1,2 +0,0 @@
#!/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

@ -1,19 +0,0 @@
#!/bin/sh
# Toggle floating dropdown terminal in i3, or start if non-existing.
# $1 is the script run in the terminal.
# All other args are terminal settings.
# Terminal names are in dropdown_* to allow easily setting i3 settings.
[ -z "$1" ] && exit
script=$1
shift
if xwininfo -tree -root | grep "(\"dropdown_$script\" ";
then
echo "Window detected."
i3 "[instance=\"dropdown_$script\"] scratchpad show; [instance=\"dropdown_$script\"] move position center"
else
echo "Window not detected... spawning."
i3 "exec --no-startup-id $TERMINAL -n dropdown_$script $@ -e $script"
fi

@ -1,73 +0,0 @@
#!/bin/sh
# A UI for detecting and selecting all displays.
# Probes xrandr for connected displays and lets user select one to use.
# User may also select "manual selection" which opens arandr.
# I plan on adding a routine from multi-monitor setups later.
twoscreen() { # If multi-monitor is selected and there are two screens.
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
# Mirror displays using native resolution of external display and a scaled
# version for the internal display
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
internal=$(echo "$screens" | grep -v "$external")
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
tail -n 1 | awk '{print $1}')
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//')
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
xrandr --output "$external" --auto --scale 1.0x1.0 \
--output "$internal" --auto --same-as "$external" \
--scale "$scale_x"x"$scale_y"
else
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v "$primary")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
fi
}
morescreen() { # If multi-monitor is selected and there are more than two screens.
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:")
xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
}
multimon() { # Multi-monitor handler.
case "$(echo "$screens" | wc -l)" in
1) xrandr $(echo "$allposs" | grep -v "$screens" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
2) twoscreen ;;
*) morescreen ;;
esac ;}
# Get all possible displays
allposs=$(xrandr -q | grep "connected")
# Get all connected screens.
screens=$(echo "$allposs" | grep " connected" | awk '{print $1}')
# Get user choice including multi-monitor and manual selection:
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
case "$chosen" in
"manual selection") arandr ; exit ;;
"multi-monitor") multimon ;;
*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
esac
setbg # Fix background if screen size/arangement has changed.
remaps # Re-remap keys if keyboard added (for laptop bases)
pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen

@ -1,105 +0,0 @@
#!/bin/sh
# Usage:
# `record`: Ask for recording type via dmenu
# `record screencast`: Record both audio and screen
# `record video`: Record only screen
# `record audio`: Record only audio
# `record kill`: Kill existing recording
#
# If there is already a running instance, user will be prompted to end it.
updateicon() { \
echo "$1" > /tmp/recordingicon
pkill -RTMIN+9 i3blocks
}
killrecording() {
recpid="$(cat /tmp/recordingpid)"
# kill with SIGTERM, allowing finishing touches.
kill -15 "$recpid"
rm -f /tmp/recordingpid
updateicon ""
pkill -RTMIN+9 i3blocks
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
sleep 3
kill -9 "$recpid"
exit
}
screencast() { \
ffmpeg -y \
-f x11grab \
-framerate 60 \
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
-i $DISPLAY \
-f alsa -i default \
-r 30 \
-c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "⏺️🎙️"
}
video() { ffmpeg \
-f x11grab \
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
-i $DISPLAY \
-c:v libx264 -qp 0 -r 30 \
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "⏺️"
}
webcamhidef() { ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 1920x1080 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "🎥"
}
webcam() { ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 640x480 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "🎥"
}
audio() { \
ffmpeg \
-f alsa -i default \
-c:a flac \
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
echo $! > /tmp/recordingpid
updateicon "🎙️"
}
askrecording() { \
choice=$(printf "screencast\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
case "$choice" in
screencast) screencast;;
audio) audio;;
video) video;;
webcam) webcam;;
"webcam (hi-def)") webcamhidef;;
esac
}
asktoend() { \
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
[ "$response" = "Yes" ] && killrecording
}
case "$1" in
screencast) screencast;;
audio) audio;;
video) video;;
kill) killrecording;;
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
esac

@ -1,2 +0,0 @@
#!/bin/sh
ifinstalled bc && echo "Welcome to the Calculator." && bc -lq

@ -1,14 +0,0 @@
#!/bin/sh
[ -z "$1" ] && exit # If $1 is left, hovers in the bottom left, if right, the bottom right
current=$(xdotool getwindowfocus)
newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3))
newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3))
xdotool windowsize "$current" $newheight $newwidth
newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*")
case "$1" in
left) horizontal=0; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;;
right) horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth)) ; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;;
esac
xdotool windowmove "$current" $horizontal $vertical

@ -1,9 +0,0 @@
#!/bin/sh
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
"a selected area") maim -s pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;;
"current window") maim -i "$(xdotool getactivewindow)" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;;
"full screen") maim pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;;
"a selected area (copy)") maim -s | xclip -selection clipboard -t image/png ;;
"current window (copy)") maim -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;;
"full screen (copy)") maim | xclip -selection clipboard -t image/png ;;
esac

@ -1,5 +0,0 @@
#!/bin/sh
PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
cd "$(readlink /proc/"$PID"/cwd)"
"$TERMINAL"

@ -1,10 +0,0 @@
#!/bin/sh
# If transmission-daemon is running, will ask to kill, else will ask to start.
if pgrep -x transmission-da >/dev/null ;
then
[ "$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon killed."
else
ifinstalled transmission-cli || exit
[ "$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon started."
fi
sleep 3 && pkill -RTMIN+7 i3blocks

@ -1,6 +0,0 @@
#!/bin/sh
ifinstalled transmission-remote-cli transmission-cli || exit
! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks
$TERMINAL -e transmission-remote-cli

@ -1,18 +0,0 @@
#!/bin/sh
vidlist="
status bar https://www.youtube.com/watch?v=gKumet6b-WY
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
ncmpcpp (music player) https://www.youtube.com/watch?v=sZIEdI9TS2U
newsboat (RSS reader) https://www.youtube.com/watch?v=dUFCRqs822w
zathura (pdf viewer) https://www.youtube.com/watch?v=V_Iz4zdyRM4
gpg keys https://www.youtube.com/watch?v=DMGIlj7u7Eo
calcurse (calendar) https://www.youtube.com/watch?v=hvc-pHjbhdE
urlview https://www.youtube.com/watch?v=IgzpAjFgbCw
colorschemes with pywal https://www.youtube.com/watch?v=Es79N_9BblE
vi mode in shell https://www.youtube.com/watch?v=GqoJQft5R2E
"
echo "$vidlist" | grep -P "^$(echo "$vidlist" | grep "https:" | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 20 | awk '{print $1}')\s" | sed 's/.*\t//' | xargs -r mpv

@ -1,2 +0,0 @@
#!/bin/sh
echo "📐" | dmenu -p "Give width and height:" | xargs xdotool windowsize "$(xdotool getwindowfocus)"

@ -0,0 +1,59 @@
#!/bin/sh
# Gives a dmenu prompt to mount unmounted drives.
# If they're in /etc/fstab, they'll be mounted automatically.
# Otherwise, you'll be prompted to give a mountpoint from already existsing directories.
# If you input a novel directory, it will prompt you to create that directory.
getmount() { \
[ -z "$chosen" ] && exit 1
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")"
[ "$mp" = "" ] && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}
mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')"
sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \\( -path *%s -prune \\) \\ \n",$3}')
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
esac
notify-send "💻 USB mounting" "$chosen mounted to $mp."
}
mountandroid() { \
chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1)
getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp"
notify-send "🤖 Android Mounting" "Android device mounted to $mp."
}
asktype() { \
case $(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?") in
USB) mountusb ;;
Android) mountandroid ;;
esac
}
anddrives=$(simple-mtpfs -l 2>/dev/null)
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')"
if [ -z "$usbdrives" ]; then
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
echo "Android device(s) detected."
mountandroid
else
if [ -z "$anddrives" ]; then
echo "USB drive(s) detected."
mountusb
else
echo "Mountable USB drive(s) and Android device(s) detected."
asktype
fi
fi

@ -0,0 +1,20 @@
#!/bin/sh
# Gives a dmenu prompt to search DuckDuckGo.
# Without input, will open DuckDuckGo.com.
# URLs will be directly handed to the browser.
# Anything else, it search it.
browser=${BROWSER:-firefox}
pgrep -x dmenu && exit
choice=$(echo "🦆" | dmenu -i -p "Search DuckDuckGo:") || exit 1
if [ "$choice" = "🦆" ]; then
$RTV_BROWSER "https://duckduckgo.com"
else
if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then
$RTV_BROWSER "$choice"
else
$RTV_BROWSER "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1"
fi
fi

@ -1,38 +0,0 @@
#!/bin/sh
# This script will compile or run another finishing operation on a document. I
# have this script run via vim.
#
# Compiles .tex. groff (.mom, .ms), .rmd, .md. Opens .sent files as sent
# presentations. Runs scripts based on extention or shebang
file=$(readlink -f "$1")
dir=$(dirname "$file")
base="${file%.*}"
cd "$dir" || exit
textype() { \
command="pdflatex"
( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex"
$command --output-directory="$dir" "$base" &&
grep -i addbibresource "$file" >/dev/null &&
biber --input-directory "$dir" "$base" &&
$command --output-directory="$dir" "$base" &&
$command --output-directory="$dir" "$base"
}
case "$file" in
*\.ms) refer -PS -e "$file" | groff -me -ms -kept -T pdf > "$base".pdf ;;
*\.mom) refer -PS -e "$file" | groff -mom -kept -T pdf > "$base".pdf ;;
*\.[0-9]) refer -PS -e "$file" | groff -mandoc -T pdf > "$base".pdf ;;
*\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;;
*\.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" ;;
*\.go) go run "$file" ;;
*\.sent) setsid sent "$file" 2>/dev/null & ;;
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
esac

@ -1,41 +0,0 @@
#!/bin/sh
# A general, all-purpose extraction script.
#
# Default behavior: Extract archive into new directory
# Behavior with `-c` option: Extract contents into current directory
while getopts "hc" o; do case "${o}" in
c) extracthere="True" ;;
*) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit ;;
esac done
if [ -z "$extracthere" ]; then
archive="$(readlink -f "$*")" &&
directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
mkdir -p "$directory" &&
cd "$directory" || exit
else
archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")"
fi
[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit
if [ -f "$archive" ] ; then
case "$archive" in
*.tar.bz2|*.tar.xz|*.tbz2) tar xvjf "$archive" ;;
*.tar.gz|*.tgz) tar xvzf "$archive" ;;
*.lzma) unlzma "$archive" ;;
*.bz2) bunzip2 "$archive" ;;
*.rar) unrar x -ad "$archive" ;;
*.gz) gunzip "$archive" ;;
*.tar) tar xvf "$archive" ;;
*.zip) unzip "$archive" ;;
*.Z) uncompress "$archive" ;;
*.7z) 7z x "$archive" ;;
*.xz) unxz "$archive" ;;
*.exe) cabextract "$archive" ;;
*) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
esac
else
printf "File \"%s\" not found.\\n" "$archive"
fi

@ -1,14 +0,0 @@
#!/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"

@ -1,4 +0,0 @@
#!/bin/sh
cat ~/.config/getkeys/"$1" 2>/dev/null && exit
echo "Run command with one of the following arguments for info about that program:"
ls ~/.config/getkeys

@ -7,35 +7,16 @@ case "$1" in
u*) pulsemixer --change-volume +"$num" ;;
d*) pulsemixer --change-volume -"$num" ;;
m*) pulsemixer --toggle-mute ;;
truemute) pulsemixer --mute ;;
play) mpc play ;;
n*) mpc next ;;
prev) mpc prev ;;
t*) mpc toggle ;;
p*) mpc pause ; pauseallmpv ;;
f*) mpc seek +"$num" ;;
b*) mpc seek -"$num" ;;
r*) mpc seek 0% ;;
*) cat << EOF
lmc: cli music interface for mpd and pulse for those with divine intellect too
grand to remember the mpc/pamixer commands.
lmc: cli music interface for pulse for those with divine intellect too
grand to remember the pamixer commands.
Allowed options:
up NUM Increase volume (2 secs default)
down NUM Decrease volume (2 secs default)
mute Toggle mute
truemute Mute
next Next track
prev Previous track
toggle Toggle pause
truepause Pause
foward NUM Seek foward in song (2 secs default)
back NUM Seek back in song (2 secs default)
restart Restart current song
all else Print this message
All of these commands, except for \`truemute\`, \`prev\` and \`play\` can be truncated,
i.e. \`lmc r\` for \`lmc restart\`.
EOF
esac

@ -1,11 +0,0 @@
#!/bin/sh
# opout: "open output": A general handler for opening a file's intended output.
# I find this useful especially running from vim.
basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
case "$1" in
*.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;;
*.html) setsid "$BROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;;
*.sent) setsid sent "$1" >/dev/null 2>&1 & ;;
esac

@ -1,4 +0,0 @@
#!/bin/sh
for i in $(ls /tmp/mpvsoc*); do
echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
done

@ -1,6 +0,0 @@
#!/bin/sh
# entr command to run `queueandnotify` when newsboat queue is changed
[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit
echo ~/.local/share/newsboat/queue | entr -p queueandnotify 2>/dev/null

@ -4,4 +4,4 @@
# For example:
# `./prompt "Do you want to shutdown?" "shutdown -h now"`
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2
[ "$(printf "No\\nYes" | dmenu -i -fn Monospace-15 -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2

@ -1,11 +0,0 @@
#!/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="youtube-dl --add-metadata"
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."

@ -1,13 +0,0 @@
#!/bin/sh
# Podboat sucks. This script replaces it.
# It reads the newsboat queue, queuing downloads with taskspooler.
# It also removes the junk from extentions.
queuefile="$HOME/.local/share/newsboat/queue"
while read -r line; do
[ -z "$line" ] && continue
url="$(echo "$line" | awk '{print $1}')"
qndl "$url" "curl -LO"
done < "$queuefile"
echo > "$queuefile"

@ -1,4 +0,0 @@
#!/bin/sh
# This script is called by i3 on startup to remap keys.
# Increase key speed via a rate change
xset r rate 300 50

@ -1,4 +0,0 @@
#!/bin/sh
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
base="$(basename $1)"
ls "$PWD" | awk "BEGIN { lines = \"\"; m = 0; } /^$base$/ { m = 1; } { if (!m) { if (lines) { lines = lines\"\n\"; } lines = lines\"\"\$0; } else { print \$0; } } END { print lines; }"

@ -1,9 +0,0 @@
#!/bin/sh
! echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null &&
notify-send "That doesn't look like a full URL." && exit
RSSFILE="$HOME/.config/newsboat/urls"
if awk '{print $1}' "$RSSFILE" | grep "^$1$" >/dev/null; then
notify-send "You already have this RSS feed."
else
echo "$1" >> "$RSSFILE" && notify-send "RSS feed added."
fi

@ -1,26 +0,0 @@
#!/bin/bash
# Output locations. Unactivated progs should go to /dev/null.
shell_shortcuts="$HOME/.config/shortcutrc"
ranger_shortcuts="/dev/null"
qute_shortcuts="/dev/null"
fish_shortcuts="/dev/null"
vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts"
# Remove, prepare files
rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null
printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
# Format the `bmdirs` file in the correct syntax and sent it to all three configs.
sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
>(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \
>(awk '{print "map g" $1, ":cd", $2 "<CR>\nmap t" $1, "<tab>:cd", $2 "<CR><tab>\nmap M" $1, "<tab>:cd", $2 "<CR><tab>:mo<CR>\nmap Y" $1, "<tab>:cd", $2 "<CR><tab>:co<CR>" }' >> "$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"
# Format the `configs` file in the correct syntax and sent it to both configs.
sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
>(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \
>(awk '{print "map", $1, ":e", $2 "<CR>" }' >> "$vifm_shortcuts") \
| awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"

@ -1,14 +0,0 @@
#!/bin/sh
# Clears the build files of a LaTeX/XeLaTeX build.
# I have vim run this file whenever I exit a .tex file.
case "$1" in
*.tex)
file=$(readlink -f "$1")
dir=$(dirname "$file")
base="${file%.*}"
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete ;;
*) printf "Give .tex file as argument.\\n" ;;
esac

@ -1,9 +0,0 @@
#!/bin/sh
# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running.
# transmission-daemon sometimes fails to take remote requests in its first moments.
pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks)
transmission-remote -a "$@" && notify-send "🔽 Torrent added."

@ -1,13 +0,0 @@
#!/usr/bin/env bash
[ -z "$FIFO_UEBERZUG" ] && exit
readonly ID_PREVIEW="preview"
if [ "$1" = "draw" ]; then
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="${PWD}/$6") > "$FIFO_UEBERZUG"
elif [ "$1" = "videopreview" ]; then
[ ! -f "/tmp/$6.png" ] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp/$6.png" -s 0 -q 10 &&
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="/tmp/$6.png") > "$FIFO_UEBERZUG"
else
declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") > "$FIFO_UEBERZUG"
fi

@ -1,15 +0,0 @@
#!/usr/bin/env sh
export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}"
cleanup() {
rm "$FIFO_UEBERZUG" 2>/dev/null
pkill -P $$ 2>/dev/null
}
rm "$FIFO_UEBERZUG" 2>/dev/null
mkfifo "$FIFO_UEBERZUG"
trap cleanup EXIT
tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash &
vifm
cleanup
Loading…
Cancel
Save