#!/usr/bin/env bash # while-menu-dialog: a menu driven system information program export ME="/home/gmgauthier" DIALOG_CANCEL=1 DIALOG_ESC=255 HEIGHT=18 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 \ "e" "Mutt Email" \ "c" "Calcurse Calendar" \ "a" "Abook Contacts" \ "t" "Tudu Tasks" \ "k" "Kabmat Kanban" \ "n" "Tilde Notepad" \ "l" "CLI Calculator" \ "f" "MC File Manager" \ "i" "IRC Client" \ "p" "Castero Podcasts" \ "m" "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 e ) neomutt -F ${ME}/.config/mutt/.protonmuttrc ;; c ) calcurse -c ${ME}/.local/share/calcurse/calendar -C ${ME}/.config/calcurse ;; a ) abook --datafile ${ME}/.local/share/abook/addressbook ;; t ) tudu -f ${ME}/.local/share/tudu/tasks.xml -c ${ME}/.config/tudu/config ;; k ) kabmat ;; n ) tmemo ;; l ) calc ;; f ) mc ;; i ) weechat ;; p ) castero ;; m ) vlc -Z -L -I ncurses --no-video --recursive expand ${ME}/Music ;; esac } while true do _stopnow menu done