let a thousand autistic tweaks bloom

This commit is contained in:
Luke Smith 2018-12-01 14:34:14 -05:00
parent 5da0c95a7d
commit 6efc27037a
11 changed files with 37 additions and 41 deletions

View file

@ -1,7 +1,6 @@
#!/bin/bash
#!/bin/sh
# This script move the selected window to the bottom left of the screen.
current=$(xdotool getwindowfocus)
# The window will take up no more than a third of
@ -9,9 +8,9 @@ current=$(xdotool getwindowfocus)
newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3))
newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3))
xdotool windowsize $(xdotool getwindowfocus) $newheight $newwidth
xdotool windowsize "$(xdotool getwindowfocus)" $newheight $newwidth
newsize=$(xdotool getwindowgeometry $(xdotool getwindowfocus) | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
newsize=$(xdotool getwindowgeometry "$(xdotool getwindowfocus)" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
height=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize))
xdotool windowmove $current 0 $height
xdotool windowmove "$current" 0 $height

View file

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

View file

@ -12,7 +12,6 @@
# bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24
# Similar to above but with `dropdowncalc` and the other args are interpretated as for my terminal emulator (to increase font)
[ -z "$1" ] && exit
if xwininfo -tree -root | grep "(\"$1\" ";

View file

@ -43,7 +43,5 @@ esac
# Fix feh background if screen size/arangement has changed.
feh --bg-scale "$HOME/.config/wall.png"
# Polybar users will want to uncomment this line, which reactivates polybar on all new displays:
#polybar_launch
# Re-remap keys if keyboard added (for laptop bases)
remaps

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152
CMD=$TERMINAL
@ -8,20 +8,20 @@ CWD=''
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
# Get PID of process whose window this is
PID=$(xprop -id $ID | grep -m 1 PID | cut -d " " -f 3)
PID=$(xprop -id "$ID" | grep -m 1 PID | cut -d " " -f 3)
# Get last child process (shell, vim, etc)
if [ -n "$PID" ]; then
TREE=$(pstree -lpA $PID | tail -n 1)
PID=$(echo $TREE | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
TREE=$(pstree -lpA "$PID" | tail -n 1)
PID=$(echo "$TREE" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
# If we find the working directory, run the command in that directory
if [ -e "/proc/$PID/cwd" ]; then
CWD=$(readlink /proc/$PID/cwd)
CWD=$(readlink /proc/"$PID"/cwd)
fi
fi
if [ -n "$CWD" ]; then
cd $CWD && $CMD
cd "$CWD" && "$CMD"
else
$CMD
"$CMD"
fi

View file

@ -7,7 +7,6 @@
clip=$(xclip -o -selection clipboard)
prim=$(xclip -o -selection primary)
[ "$prim" != "" ] && notify-send "<b>Clipboard:</b>

View file

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

View file

@ -1,15 +1,21 @@
#!/bin/bash
#!/bin/sh
# Give this script a .pdf and it will attempt
# to return a proper .bib citation via doi.
# Internet connection required.
# Get the doi from metadata, if not possible, get
# doi from pdftotext output, if not possible, exit.
doi=$(pdfinfo "$1" | grep -o doi:.*) ||
doi=$(pdftotext "$1" - | grep -o doi.* -m 1) ||
if [ -f "$1" ];
then
# Get the doi from metadata, if not possible, get
# doi from pdftotext output, if not possible, exit.
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
doi=$(pdftotext "$1" 2>/dev/null - | grep -o "doi:.*" -m 1) ||
exit 1
else
# If not given file, assume argument is doi
doi="$1"
fi
# Check crossref.org for the bib citation.
curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\n" |
sed -e "/^[^\(\t\|@\|}\)]/d"
curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n" |
sed -e "/^[^\\(\\t\\|@\\|}\\)]/d"

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# A general audio interface for LARBS.
@ -18,7 +18,7 @@ case "$1" in
p*) mpc pause ; pauseallmpv ;;
f*) mpc seek +"$num" ;;
b*) mpc seek -"$num" ;;
r*) mpc seek 0\% ;;
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.

View file

@ -1,7 +0,0 @@
#!/bin/bash
base=$(basename $1)
ext="${base##*.}"
base="${base%.*}"
ffmpeg -i $1 -vf "setpts=$2*PTS" -an $base'_sped.'$ext

View file

@ -1,12 +1,14 @@
#!/bin/bash
#!/bin/sh
# Clears the build files of a LaTeX/XeLaTeX build.
# I have vim run this file whenever I exit a .tex file.
[[ "$1" == *.tex ]] || exit
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|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete ;;
*) printf "Give .tex file as argument.\\n" ;;
esac
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|nav|out|snm|toc|bcf|run\.xml|synctex\.gz|blg|bbl)" -delete