diff --git a/.config/lf/scope b/.config/lf/scope index 180c2947..1e518461 100755 --- a/.config/lf/scope +++ b/.config/lf/scope @@ -30,12 +30,12 @@ case "$(file --dereference --brief --mime-type -- "$1")" in audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; video/* ) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" - [ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + [ -f "$CACHE" ] || ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 image "$CACHE" "$2" "$3" "$4" "$5" "$1" ;; */pdf) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" - [ ! -f "$CACHE.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" + [ -f "$CACHE.jpg" ] || pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; *opendocument*) odt2txt "$1" ;; diff --git a/.config/shell/profile b/.config/shell/profile index 9515179d..6932bb2e 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -140,11 +140,11 @@ ex=🎯:\ *.java=♨:\ " -[ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ] && shortcuts >/dev/null 2>&1 & +[ -f ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ] || shortcuts >/dev/null 2>&1 & if pacman -Qs libxft-bgra >/dev/null 2>&1; then # Start graphical server on user's current tty if not already running. - [ "$(tty)" = "/dev/tty1" ] && ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC" + [ "$(tty)" = "/dev/tty1" ] && pidof -s Xorg >/dev/null 2>&1 || exec startx "$XINITRC" else echo "\033[31mIMPORTANT\033[0m: Note that \033[32m\`libxft-bgra\`\033[0m must be installed for this build of dwm. Please run: diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler index 4a4f10a1..b5514f82 100755 --- a/.config/sxiv/exec/key-handler +++ b/.config/sxiv/exec/key-handler @@ -5,12 +5,12 @@ do "w") setbg "$file" & ;; "c") [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" - [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + [ -d "$destdir" ] || notify-send "$destdir is not a directory, cancelled." && exit cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & ;; "m") [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" - [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + [ -d "$destdir" ] || notify-send "$destdir is not a directory, cancelled." && exit mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & ;; "r") diff --git a/.local/bin/booksplit b/.local/bin/booksplit index 69e4f36c..7e65a6d4 100755 --- a/.local/bin/booksplit +++ b/.local/bin/booksplit @@ -2,7 +2,7 @@ # Requires ffmpeg -[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit +[ -f "$2" ] || printf "The first file should be the audio, the second should be the timecodes.\\n" && exit echo "Enter the album/book title:"; read -r booktitle echo "Enter the artist/author:"; read -r author @@ -14,7 +14,7 @@ ext="${1#*.}" # Get a safe file name from the book. escbook="$(echo "$booktitle" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")" -! mkdir -p "$escbook" && +mkdir -p "$escbook" || echo "Do you have write access in this directory?" && exit 1 diff --git a/.local/bin/dmenumountcifs b/.local/bin/dmenumountcifs index 46c2b57a..84656278 100755 --- a/.local/bin/dmenumountcifs +++ b/.local/bin/dmenumountcifs @@ -11,7 +11,7 @@ share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p share2mnt=//"$srvname".local/"$share" sharemount() { - mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share") + mounted=$(mount -v | grep "$share2mnt") || ([ -d /mnt/"$share" ] || sudo mkdir /mnt/"$share") [ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0 notify-send "Netshare $share already mounted"; exit 1 } diff --git a/.local/bin/lfub b/.local/bin/lfub index 9012f506..288dece6 100755 --- a/.local/bin/lfub +++ b/.local/bin/lfub @@ -14,7 +14,7 @@ cleanup() { if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then lf "$@" else - [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf" + [ -d "$HOME/.cache/lf" ] || mkdir -p "$HOME/.cache/lf" export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" mkfifo "$FIFO_UEBERZUG" ueberzug layer -s <"$FIFO_UEBERZUG" -p json & diff --git a/.local/bin/slider b/.local/bin/slider index 674781a4..211aab60 100755 --- a/.local/bin/slider +++ b/.local/bin/slider @@ -94,10 +94,10 @@ do if [ -f "$content" ]; then # If images have already been made in a previous run, do not recreate # them unless -r was given. - { [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} && + { [ -f "$prepdir/$base" ] && [ -n "${redo+x}" ] ;} && convert -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base" else - { [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} && + { [ -f "$prepdir/$base" ] && [ -n "${redo+x}" ] ;} && convert -size "${res:-1920x1080}" -background "${bgc:-black}" -fill "${fgc:-white}" -font "${font:-Sans}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base" fi diff --git a/.local/bin/statusbar/sb-cpubars b/.local/bin/statusbar/sb-cpubars index 297424e7..8f5d8e87 100755 --- a/.local/bin/statusbar/sb-cpubars +++ b/.local/bin/statusbar/sb-cpubars @@ -17,7 +17,7 @@ esac # id total idle stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) -[ ! -f $cache ] && echo "$stats" > "$cache" +[ -f $cache ] || echo "$stats" > "$cache" old=$(cat "$cache") printf "🪨" echo "$stats" | while read -r row; do diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/statusbar/sb-doppler index 91ec3106..ee0f7293 100755 --- a/.local/bin/statusbar/sb-doppler +++ b/.local/bin/statusbar/sb-doppler @@ -266,7 +266,7 @@ getdoppler() { showdoppler() { setsid -f mpv --no-osc --loop=inf --no-terminal "$doppler" ;} case $BLOCK_BUTTON in - 1) [ ! -f "$radarloc" ] && pickloc && getdoppler + 1) [ -f "$radarloc" ] || pickloc && getdoppler [ $(($(date '+%s') - $(stat -c %Y "$doppler"))) -gt "$secs" ] && getdoppler showdoppler ;; 2) pickloc && getdoppler && showdoppler ;; diff --git a/.local/bin/tag b/.local/bin/tag index 8462b99a..f5245910 100755 --- a/.local/bin/tag +++ b/.local/bin/tag @@ -30,7 +30,7 @@ shift $((OPTIND - 1)) file="$1" -[ ! -f "$file" ] && echo "Provide file to tag." && err +[ -f "$file" ] || echo "Provide file to tag." && err [ -z "$title" ] && echo "Enter a title." && read -r title [ -z "$artist" ] && echo "Enter an artist." && read -r artist diff --git a/.local/bin/torwrap b/.local/bin/torwrap index 8b20ad4f..8e48ca36 100755 --- a/.local/bin/torwrap +++ b/.local/bin/torwrap @@ -2,6 +2,6 @@ ifinstalled tremc transmission-cli || exit -! pidof transmission-daemon >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." +pidof transmission-daemon >/dev/null || transmission-daemon && notify-send "Starting torrent daemon..." $TERMINAL -e tremc; pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}"