shell-utils/app/menu

113 lines
2.2 KiB
Plaintext
Raw Normal View History

2023-07-15 19:21:25 +00:00
#!/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"
exec 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
exec neomutt -F ${ME}/.config/mutt/.protonmuttrc
;;
2 )
clear
exec calcurse -c ${ME}/.local/share/calcurse/calendar -C ${ME}/.config/calcurse
;;
3 )
clear
exec abook --datafile ${ME}/.local/share/abook/addressbook
;;
4 )
clear
exec tudu -f ${ME}/.local/share/tudu/tasks.xml -c ${ME}/.config/tudu/config
;;
5 )
clear
tmemo
;;
6 )
clear
exec calc
;;
7 )
clear
exec mc
;;
8 )
clear
exec weechat
;;
9 )
clear
exec castero
;;
0 )
clear
exec vlc -Z -L -I ncurses --no-video --recursive expand ${ME}/Music
;;
esac
}
while true; do
_stopnow
menu
done