dotfiles

Luke's GNU/Linux dotfiles for i3, vim, ranger, bash, mpd, etc.
git clone git@git.lukesmith.xyz:dotfiles
Log | Files | Refs | README | LICENSE

commit 976b7d33f760317a18a6307895fd95c3309139c1
parent d8ba8b2bdd71dcbbee1e8c309a45608526d851b3
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Sat,  1 Dec 2018 14:34:14 -0500

let a thousand autistic tweaks bloom

Diffstat:
M.scripts/i3cmds/bottomleft | 9++++-----
M.scripts/i3cmds/camtoggle | 2+-
M.scripts/i3cmds/ddspawn | 1-
M.scripts/i3cmds/displayselect | 2--
M.scripts/i3cmds/samedir | 14+++++++-------
M.scripts/i3cmds/showclip | 1-
M.scripts/i3cmds/winresize | 2+-
M.scripts/tools/getbib | 20+++++++++++++-------
M.scripts/tools/lmc | 4++--
D.scripts/tools/speedvid | 7-------
M.scripts/tools/texclear | 16+++++++++-------
11 files changed, 37 insertions(+), 41 deletions(-)

diff --git a/.scripts/i3cmds/bottomleft b/.scripts/i3cmds/bottomleft @@ -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 diff --git a/.scripts/i3cmds/camtoggle b/.scripts/i3cmds/camtoggle @@ -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 diff --git a/.scripts/i3cmds/ddspawn b/.scripts/i3cmds/ddspawn @@ -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\" "; diff --git a/.scripts/i3cmds/displayselect b/.scripts/i3cmds/displayselect @@ -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 diff --git a/.scripts/i3cmds/samedir b/.scripts/i3cmds/samedir @@ -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 diff --git a/.scripts/i3cmds/showclip b/.scripts/i3cmds/showclip @@ -7,7 +7,6 @@ clip=$(xclip -o -selection clipboard) - prim=$(xclip -o -selection primary) [ "$prim" != "" ] && notify-send "<b>Clipboard:</b> diff --git a/.scripts/i3cmds/winresize b/.scripts/i3cmds/winresize @@ -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)" diff --git a/.scripts/tools/getbib b/.scripts/tools/getbib @@ -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" diff --git a/.scripts/tools/lmc b/.scripts/tools/lmc @@ -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. diff --git a/.scripts/tools/speedvid b/.scripts/tools/speedvid @@ -1,7 +0,0 @@ -#!/bin/bash - -base=$(basename $1) -ext="${base##*.}" -base="${base%.*}" - -ffmpeg -i $1 -vf "setpts=$2*PTS" -an $base'_sped.'$ext diff --git a/.scripts/tools/texclear b/.scripts/tools/texclear @@ -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