From dfa46f523782434582c1382efb8312dc5add248d Mon Sep 17 00:00:00 2001 From: "Eshan Roy (Eshanized)" Date: Fri, 8 Mar 2024 00:04:55 +0530 Subject: [PATCH] @eshanized: push via script --- common/snigdhaos-libs/exec-terminal | 39 ++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/common/snigdhaos-libs/exec-terminal b/common/snigdhaos-libs/exec-terminal index 624bf00f..193a49df 100644 --- a/common/snigdhaos-libs/exec-terminal +++ b/common/snigdhaos-libs/exec-terminal @@ -59,4 +59,41 @@ LXQt) MATE) terminal=mate-terminal ;; -esac \ No newline at end of file +esac + +if [ -z "$terminal" ] || ! command -v "$terminal" &>/dev/null; then + # shellcheck disable=SC2068 + for i in ${term_order[@]}; do + if command -v "$i" &>/dev/null; then + terminal="$i" + break + fi + done +fi + +if [ -z "$terminal" ]; then + notify-send -t 1500 --app-name=Snigdha\ OS "No Terminal Found!" + exit 1 +fi + +if [ "$terminal" == "kgx" ]; then + # shellcheck disable=SC2086 + sed -i '2i sleep 0.1' $initfile + # shellcheck disable=SC2016 + # shellcheck disable=SC2086 + echo 'Kill -SIGNINT $PPID' >>$initfile +fi + +eval "${terminals[${terminal}]}" || { + exitcode=$? +} + +rm "$initfile" + +if [ "$codefile" != "$initfile" ]; then + rm "$codefile" +fi + +if [ ! -z "$exitcode" ] && [ "$exitcode" != 130 ]; then + exit 2 +fi \ No newline at end of file