mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
flip &&/|| instead of using !
This commit is contained in:
parent
688ea20708
commit
b52a777fca
@ -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" ;;
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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 &
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 ;;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user