From 7f1038f33d4aeeff282e0c8d439819f48486154a Mon Sep 17 00:00:00 2001
From: Luca Bilke <bilke@tralios.de>
Date: Wed, 28 Feb 2024 12:42:55 +0100
Subject: [PATCH] improve upgrades script usability

---
 .local/bin/upgrades | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/.local/bin/upgrades b/.local/bin/upgrades
index ebd3c15d..8e139589 100755
--- a/.local/bin/upgrades
+++ b/.local/bin/upgrades
@@ -1,13 +1,19 @@
 #!/bin/sh
 
-st -e sh -c "
-    sudo xbps-install -Syu
+read -r script<<EOF
+sudo xbps-install -Su
+pkill -RTMIN+8 dwmblocks
+EOF
 
-    pkill -RTMIN+8 dwmblocks
-
-    tput bold
-    tput setaf 4
-    echo 'All done!'
-    tput sgr 0
-    read -r _
-"
+if [ -n "$TERM_PROGRAM" ]; then
+    $script
+else
+    st -e sh -c "
+        $script
+        tput bold
+        tput setaf 4
+        echo 'All done!'
+        tput sgr 0
+        read -r _
+    "
+fi