#!/bin/bash if [ $(dpkg-query -W -f='${Status}' dialog 2>/dev/null | grep -c "ok installed") -eq 0 ]; then sudo apt-get install dialog -y; fi SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" #echo $SCRIPTPATH HEIGHT=15 WIDTH=40 CHOICE_HEIGHT=8 BACKTITLE="CHIU!" TITLE="Chiu Launcher" MENU="Choose:" OPTIONS=(1 "htop" 2 "alpine" 3 "newsbeuter" 4 "profanity (xmpp+irc_gw)" 5 "stats" 6 "Shutdown!" 7 "LOCK") CHOICE=$(dialog --clear \ --backtitle "$BACKTITLE" \ --title "$TITLE" \ --menu "$MENU" \ $HEIGHT $WIDTH $CHOICE_HEIGHT \ "${OPTIONS[@]}" \ 2>&1 >/dev/tty) clear case $CHOICE in 1) htop && $SCRIPTPATH/./splash.sh ;; 2) alpine && $SCRIPTPATH/./splash.sh ;; 3) newsbeuter && $SCRIPTPATH/./splash.sh ;; 4) profanity && $SCRIPTPATH/./splash.sh ;; 5) $SCRIPTPATH/./stats.sh && $SCRIPTPATH/./splash.sh ;; 6) sudo shutdown -h now ;; 7) vlock && $SCRIPTPATH/./splash.sh ;; esac ##source: https://stackoverflow.com/questions/40193222/dialog-show-menu-after-option-has-been-executed