#!/usr/bin/env bash # while-menu-dialog: a menu driven system information program export ME="/home/gmgauthier" DIALOG_CANCEL=1 DIALOG_ESC=255 HEIGHT=17 WIDTH=0 tmemo() { tmp=$(date +"memo-%Y.%m.%d-%k.%M.%S") timestamp="${tmp// /}" filename="$HOME/memos/${timestamp}.md" tilde $filename } output_panel() { dialog --title "$1" \ --no-collapse \ --msgbox "$result" 0 0 } _stopnow() { test -f stopnow && echo "Stopping!" && rm stopnow && exit 0 || return 0 } menu() { exec 3>&1 selection=$(dialog \ --backtitle "TUI Command Center" \ --title "Menu" \ --clear \ --cancel-label "Exit" \ --menu "Please select:" $HEIGHT $WIDTH 4 \ "1" "Mutt Email" \ "2" "Calcurse Calendar" \ "3" "Abook Contacts" \ "4" "Tudu Tasks" \ "5" "Tilde Notepad" \ "6" "CLI Calculator" \ "7" "MC File Manager" \ "8" "IRC Client" \ "9" "Castero Podcasts" \ "0" "VLC Music Player" \ 2>&1 1>&3) exit_status=$? exec 3>&- case $exit_status in $DIALOG_CANCEL) clear echo "Exiting Apps Menu." exit 1 ;; $DIALOG_ESC) clear echo "Terminating Apps Menu." >&2 exit 1 ;; esac clear case $selection in 1 ) clear neomutt -F ${ME}/.config/mutt/.protonmuttrc ;; 2 ) clear calcurse -c ${ME}/.local/share/calcurse/calendar -C ${ME}/.config/calcurse ;; 3 ) clear abook --datafile ${ME}/.local/share/abook/addressbook ;; 4 ) clear tudu -f ${ME}/.local/share/tudu/tasks.xml -c ${ME}/.config/tudu/config ;; 5 ) clear tmemo ;; 6 ) clear calc ;; 7 ) clear mc ;; 8 ) clear weechat ;; 9 ) clear castero ;; 0 ) clear vlc -Z -L -I ncurses --no-video --recursive expand ${ME}/Music ;; esac } while true do _stopnow menu done