removed exec on app calls

This commit is contained in:
Greg Gauthier 2023-07-15 20:54:52 +01:00
parent b87984ccce
commit d7953e948c
2 changed files with 103 additions and 115 deletions

106
app/apps
View File

@ -1,13 +1,113 @@
#!/usr/bin/env zsh #!/usr/bin/env bash
set -eo pipefail
# 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() { _stopnow() {
test -f stopnow && echo "Stopping!" && rm stopnow && exit 0 || return 0 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 while true
do do
_stopnow _stopnow
menu menu
done done

112
app/menu
View File

@ -1,112 +0,0 @@
#!/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