[scripts] fix: error codes
dmenuopen: don't return 0 in case of actual errors switch-colors: no need to exit 0 if everything went well
This commit is contained in:
parent
01cac0167f
commit
ce6a7026d7
@ -13,15 +13,12 @@
|
|||||||
filetypes="pdf png jpg txt mom tex mkv" # could be augmented
|
filetypes="pdf png jpg txt mom tex mkv" # could be augmented
|
||||||
filetype=$(printf "$filetypes" | sed "s| |\n|g" | dmenu -i -p "type of the file?")
|
filetype=$(printf "$filetypes" | sed "s| |\n|g" | dmenu -i -p "type of the file?")
|
||||||
|
|
||||||
if [ -z "$filetype" ]; then
|
[ -z "$filetype" ] && exit 1
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
file=$(find $HOME/{documents,downloads} -type f -path "*.$filetype" | dmenu -i -l 20 -p "open")
|
file=$(find $HOME/{documents,downloads} -type f -path "*.$filetype" | dmenu -i -l 20 -p "open")
|
||||||
|
|
||||||
if [ -z "$file" ]; then
|
[ -z "$file" ] && exit 2
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$filetype" in
|
case "$filetype" in
|
||||||
pdf) zathura "$file" ;;
|
pdf) zathura "$file" ;;
|
||||||
|
@ -46,5 +46,3 @@ else
|
|||||||
switch_scheme
|
switch_scheme
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
Reference in New Issue
Block a user