diff options
Diffstat (limited to '.scripts')
| -rwxr-xr-x | .scripts/getbib | 15 | ||||
| -rwxr-xr-x | .scripts/getkeys | 12 | ||||
| -rwxr-xr-x | .scripts/i3mail | 2 | ||||
| -rwxr-xr-x | .scripts/i3mpd | 2 | ||||
| -rwxr-xr-x | .scripts/i3pacman | 8 | ||||
| -rwxr-xr-x | .scripts/i3torrent | 7 | ||||
| -rwxr-xr-x | .scripts/i3volume | 2 | ||||
| -rwxr-xr-x | .scripts/i3weather | 4 | ||||
| -rwxr-xr-x | .scripts/samedir | 27 | ||||
| -rwxr-xr-x | .scripts/tutorialvids | 3 |
10 files changed, 77 insertions, 5 deletions
diff --git a/.scripts/getbib b/.scripts/getbib new file mode 100755 index 0000000..0ea30d3 --- /dev/null +++ b/.scripts/getbib @@ -0,0 +1,15 @@ +#!/bin/bash + +# 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) || + exit 1 + +# 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" diff --git a/.scripts/getkeys b/.scripts/getkeys new file mode 100755 index 0000000..9cef862 --- /dev/null +++ b/.scripts/getkeys @@ -0,0 +1,12 @@ +#!/bin/sh + +elsewhere() { echo Key mappings available for the following programs: +ls ~/.larbs +echo Run \`larbs-keys\` followed by a program name to get bindings ;} + +if [[ -f ~/.larbs/getkeys/$1 ]]; then +cat ~/.larbs/getkeys/$1 +else +echo Run command with one of the following arguments for info about that program: +ls ~/.larbs/getkeys +fi diff --git a/.scripts/i3mail b/.scripts/i3mail index 616facf..46ad432 100755 --- a/.scripts/i3mail +++ b/.scripts/i3mail @@ -2,4 +2,4 @@ case $BLOCK_BUTTON in 1) $TERMINAL -e neomutt ;; esac -echo $(find ~/.mail -wholename */INBOX/new/* | wc -l | sed -e "s/^0$//g") $(cat ~/.config/mutt/.dl) +echo $(find ~/.mail -wholename */INBOX/new/* | sed -n '$=') $(cat ~/.config/mutt/.dl) diff --git a/.scripts/i3mpd b/.scripts/i3mpd index 7cf473d..8c8564e 100755 --- a/.scripts/i3mpd +++ b/.scripts/i3mpd @@ -6,7 +6,7 @@ if [[ -n $BLOCK_INSTANCE ]]; then fi filter() { - sed 2q | tac | sed -e "/volume:/d;s/\[paused\].*/<span color=\"gray\">/g;s/\[playing\].*/<span>/g" | tr -d '\n' | sed -e "s/$/<\/span>/g" + sed 2q | tac | sed -e "s/\&/&/g;/volume:/d;s/\[paused\].*/<span color=\"gray\" font_style=\"italic\">/g;s/\[playing\].*/<span>/g" | tr -d '\n' | sed -e "s/$/<\/span>/g" } case $BLOCK_BUTTON in diff --git a/.scripts/i3pacman b/.scripts/i3pacman new file mode 100755 index 0000000..852c5b7 --- /dev/null +++ b/.scripts/i3pacman @@ -0,0 +1,8 @@ +#!/bin/bash +case $BLOCK_BUTTON in + 1) $TERMINAL -e sudo pacman -Syu && pacman -Qu | wc -l > ~/.larbs/.pacupgrade && pkill -RTMIN+8 i3blocks ;; +esac + +pacman -Qu | wc -l | sed -e '/^0$/d' > ~/.larbs/.pacupgrade && pkill -RTMIN+8 i3blocks + +cat ~/.larbs/.pacupgrade | sed -e "/^$/d" diff --git a/.scripts/i3torrent b/.scripts/i3torrent new file mode 100755 index 0000000..a367649 --- /dev/null +++ b/.scripts/i3torrent @@ -0,0 +1,7 @@ +#!/bin/bash +case $BLOCK_BUTTON in + 1) $TERMINAL -e transmission-remote-cli +esac + +transmission-remote -l | grep % | sed -e "s/.*100%.*/Z/g;s/.*Idle.*/A/g;s/.*%.*/M/g" | sort -h | uniq -c | sed -e "s/Z/🌱/g;s/A/⌛️/g;s/M/⬇️/g" | awk '{print $2, $1}' | tr '\n' ' ' + diff --git a/.scripts/i3volume b/.scripts/i3volume index b47a6fa..d0b054e 100755 --- a/.scripts/i3volume +++ b/.scripts/i3volume @@ -1,7 +1,7 @@ #!/bin/bash case $BLOCK_BUTTON in - 1) $TERMINAL -e ncpamixer & disown ;; + 1) $TERMINAL -e pulsemixer & disown ;; 3) pamixer -t ;; 4) pamixer -i 5 ;; 5) pamixer -d 5 ;; diff --git a/.scripts/i3weather b/.scripts/i3weather index cf135be..b9323c2 100755 --- a/.scripts/i3weather +++ b/.scripts/i3weather @@ -12,6 +12,6 @@ if [[ "$location" != "" ]] fi curl -s wttr.in/$location > ~/.weatherreport -echo -n $(cat ~/.weatherreport | sed -n 16p | sed -e 's/[^m]*m//g' | grep -o "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g") +echo -n $(cat ~/.weatherreport | sed '16q;d' | sed -e 's/[^m]*m//g' | grep -o "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g") -cat ~/.weatherreport | sed -n 13p | sed -e 's/[^m]*m//g;s/[^0-9]/ /g;s/ /\n/g;/^s*$/d' | grep [0-9] | sort -n | sed -e 1b -e '$!d' | tr '\n' ' ' | awk '{print " ❄️",$1 "°","☀️",$2 "°"}' +cat ~/.weatherreport | sed '13q;d' | sed -e 's/[^m]*m//g;s/[^0-9]/ /g;s/ /\n/g;/^s*$/d' | grep [0-9] | sort -n | sed -e 1b -e '$!d' | tr '\n' ' ' | awk '{print " ❄️",$1 "°","☀️",$2 "°"}' diff --git a/.scripts/samedir b/.scripts/samedir new file mode 100755 index 0000000..1bc1701 --- /dev/null +++ b/.scripts/samedir @@ -0,0 +1,27 @@ +#!/bin/bash +# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152 + +CMD=$TERMINAL +CWD='' + +# Get window ID +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) + +# 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') + + # If we find the working directory, run the command in that directory + if [ -e "/proc/$PID/cwd" ]; then + CWD=$(readlink /proc/$PID/cwd) + fi +fi +if [ -n "$CWD" ]; then + cd $CWD && $CMD +else + $CMD +fi diff --git a/.scripts/tutorialvids b/.scripts/tutorialvids new file mode 100755 index 0000000..8f73b89 --- /dev/null +++ b/.scripts/tutorialvids @@ -0,0 +1,3 @@ +#!/bin/sh + +mpv $(grep -P "^$(cat ~/.larbs/tutorialvids | grep https | awk '{print $1}' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 5)\t" ~/.larbs/tutorialvids | awk '{print $2}') |
