From d7953e948ca72a723da9683b81bef298e382f40b Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Sat, 15 Jul 2023 20:54:52 +0100 Subject: [PATCH] removed exec on app calls --- app/apps | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++-- app/menu | 112 ------------------------------------------------------- 2 files changed, 103 insertions(+), 115 deletions(-) delete mode 100755 app/menu diff --git a/app/apps b/app/apps index 54a5ba6..3560cae 100755 --- a/app/apps +++ b/app/apps @@ -1,13 +1,113 @@ -#!/usr/bin/env zsh -set -eo pipefail +#!/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 - diff --git a/app/menu b/app/menu deleted file mode 100755 index ce8a7e9..0000000 --- a/app/menu +++ /dev/null @@ -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