Better archbox-desktop script.

This commit is contained in:
lemniskett 2020-12-15 14:18:45 +07:00
parent fffc5a43cc
commit a34af6374c
2 changed files with 14 additions and 1 deletions

View File

@ -12,6 +12,15 @@ install_desktop(){
done done
} }
checkdep(){
which $1 >/dev/null 2>&1 || err "Install $1!"
}
err(){
echo "$(tput bold)$(tput setaf 1)==> $@ $(tput sgr0)"
exit 1
}
help_text(){ help_text(){
cat << EOF cat << EOF
USAGE: $0 <arguments> USAGE: $0 <arguments>
@ -30,7 +39,11 @@ case $1 in
-h|--help) -h|--help)
help_text help_text
;; ;;
-*)
err "Unknown option: $1"
;;
*) *)
checkdep zenity
list_desktop="$(archbox ls --color=none -1 /usr/share/applications)" list_desktop="$(archbox ls --color=none -1 /usr/share/applications)"
zenity_entry="$(echo $list_desktop | sed 's/\ /\ FALSE\ /g')" zenity_entry="$(echo $list_desktop | sed 's/\ /\ FALSE\ /g')"
selected_entry=$(zenity --list --checklist --height=500 --width=450 \ selected_entry=$(zenity --list --checklist --height=500 --width=450 \