diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 0f2f14d..abff151 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -106,8 +106,8 @@ alias offtouchpad='sudo rmmod i2c_hid' alias ontouchpad='sudo modprobe i2c_hid' alias nw="$HOME/.scripts/network.sh" -# Other -source $ZDOTDIR/.zshrc_extended +# Scripts +alias ltx="$HOME/.scripts/latex.sh" # Fun spurdo() { @@ -115,6 +115,9 @@ spurdo() { <<< "${@:-$(cat /dev/stdin)}" } +# Other +source $ZDOTDIR/.zshrc_extended + ## Login [[ $USER == "rick" ]] && [ "$(tty)" = "/dev/tty1" ] && exec xinit -- vt1 &> /dev/null diff --git a/.scripts/latex.sh b/.scripts/latex.sh new file mode 100755 index 0000000..0c01604 --- /dev/null +++ b/.scripts/latex.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +if [ "$1" = "kill" ]; then + kill -9 $(pgrep latex.sh) +else + DIR="$1" + OUT="$DIR/out" + mkdir -p $OUT + HASH="$(md5sum $DIR/main.tex)" + + while true; do + sleep 1 + + TMP="$(md5sum $DIR/main.tex)" + if [ "$HASH" != "$TMP" ]; then + HASH="$TMP" + pdflatex -no-file-line-error -interaction=nonstopmode -synctex=1 \ + -output-format=pdf -output-directory=$OUT $DIR/main.tex \ + > /dev/null 2>&1 + fi + done +fi +