mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Added missing exit codes
This commit is contained in:
parent
b30ca735b6
commit
25a925f1dc
@ -5,12 +5,12 @@ do
|
||||
"w") setbg "$file" & ;;
|
||||
"c")
|
||||
[ -z "$destdir" ] && destdir="$(sed "s/\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 1
|
||||
cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." &
|
||||
;;
|
||||
"m")
|
||||
[ -z "$destdir" ] && destdir="$(sed "s/\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 1
|
||||
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
|
||||
;;
|
||||
"r")
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
# Requires ffmpeg (audio splitting) and my `tag` wrapper script.
|
||||
|
||||
[ ! -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 1
|
||||
|
||||
echo "Enter the album/book title:"; read -r booktitle
|
||||
|
||||
@ -43,4 +43,4 @@ done < "$2"
|
||||
echo "From $start to the end: $title"
|
||||
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
||||
echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn -c copy "$file" &&
|
||||
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
||||
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
# Syncs repositories and downloads updates, meant to be run as a cronjob.
|
||||
|
||||
ping -q -c 1 example.org > /dev/null || exit
|
||||
ping -q -c 1 example.org > /dev/null || exit 1
|
||||
|
||||
notify-send "📦 Repository Sync" "Checking for package updates..."
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ anddrives=$(simple-mtpfs -l 2>/dev/null)
|
||||
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
|
||||
|
||||
if [ -z "$usbdrives" ]; then
|
||||
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
|
||||
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit 1
|
||||
echo "Android device(s) detected."
|
||||
mountandroid
|
||||
else
|
||||
|
||||
@ -24,7 +24,7 @@ killrecording() {
|
||||
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
|
||||
sleep 3
|
||||
kill -9 "$recpid"
|
||||
exit
|
||||
exit 0
|
||||
}
|
||||
|
||||
screencast() { \
|
||||
@ -119,5 +119,5 @@ case "$1" in
|
||||
video) video;;
|
||||
*selected) videoselected;;
|
||||
kill) killrecording;;
|
||||
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
|
||||
*) ([ -f /tmp/recordingpid ] && asktoend && exit 0) || askrecording;;
|
||||
esac
|
||||
|
||||
@ -5,16 +5,16 @@
|
||||
# Drives mounted at /, /boot and /home will not be options to unmount.
|
||||
|
||||
unmountusb() {
|
||||
[ -z "$drives" ] && exit
|
||||
[ -z "$drives" ] && exit 1
|
||||
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
|
||||
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||
[ -z "$chosen" ] && exit
|
||||
[ -z "$chosen" ] && exit 1
|
||||
sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted."
|
||||
}
|
||||
|
||||
unmountandroid() { \
|
||||
chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1
|
||||
[ -z "$chosen" ] && exit
|
||||
[ -z "$chosen" ] && exit 1
|
||||
sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ asktype() { \
|
||||
drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
|
||||
|
||||
if ! grep simple-mtpfs /etc/mtab; then
|
||||
[ -z "$drives" ] && echo "No drives to unmount." && exit
|
||||
[ -z "$drives" ] && echo "No drives to unmount." && exit 1
|
||||
echo "Unmountable USB drive detected."
|
||||
unmountusb
|
||||
else
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -i -l 30 | sed "s/ .*//")
|
||||
|
||||
# Exit if none chosen.
|
||||
[ -z "$chosen" ] && exit
|
||||
[ -z "$chosen" ] && exit 1
|
||||
|
||||
# If you run this command with an argument, it will automatically insert the
|
||||
# character. Otherwise, show a message that the emoji has been copied.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
|
||||
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit 1
|
||||
|
||||
if [ -f "$1" ]; then
|
||||
# Try to get DOI from pdfinfo or pdftotext output.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys/"$1" 2>/dev/null && exit
|
||||
cat "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys/"$1" 2>/dev/null && exit 0
|
||||
echo "Run command with one of the following arguments for info about that program:"
|
||||
ls "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $1 is a url; $2 is a command
|
||||
[ -z "$1" ] && exit
|
||||
[ -z "$1" ] && exit 1
|
||||
base="$(basename "$1")"
|
||||
notify-send "⏳ Queuing $base..."
|
||||
cmd="$2"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
! echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null &&
|
||||
notify-send "That doesn't look like a full URL." && exit
|
||||
notify-send "That doesn't look like a full URL." && exit 1
|
||||
RSSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls"
|
||||
if awk '{print $1}' "$RSSFILE" | grep "^$1$" >/dev/null; then
|
||||
notify-send "You already have this RSS feed."
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
location=${1:-/}
|
||||
|
||||
[ -d "$location" ] || exit
|
||||
[ -d "$location" ] || exit 1
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;;
|
||||
|
||||
@ -5,6 +5,6 @@
|
||||
#
|
||||
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
|
||||
|
||||
ifinstalled "geoip" || exit
|
||||
addr="$(curl ifconfig.me 2>/dev/null)" || exit
|
||||
ifinstalled "geoip" || exit 1
|
||||
addr="$(curl ifconfig.me 2>/dev/null)" || exit 1
|
||||
grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"
|
||||
|
||||
@ -13,7 +13,7 @@ case $BLOCK_BUTTON in
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
[ $(pamixer --get-mute) = true ] && echo 🔇 && exit
|
||||
[ $(pamixer --get-mute) = true ] && echo 🔇 && exit 0
|
||||
|
||||
vol="$(pamixer --get-volume)"
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ if pidof transmission-daemon >/dev/null ;
|
||||
then
|
||||
[ "$(printf "No\\nYes" | dmenu -i -p "Turn off transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon disabled."
|
||||
else
|
||||
ifinstalled transmission-cli || exit
|
||||
ifinstalled transmission-cli || exit 1
|
||||
[ "$(printf "No\\nYes" | dmenu -i -p "Turn on transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon enabled."
|
||||
fi
|
||||
sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
ifinstalled tremc-git transmission-cli || exit
|
||||
ifinstalled tremc-git transmission-cli || exit 1
|
||||
|
||||
! pidof transmission-daemon >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..."
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user