From 2759f8dd9083fd848b581aefb769fee20c214b91 Mon Sep 17 00:00:00 2001 From: alexpolo1 Date: Tue, 7 Jan 2025 19:17:45 +0100 Subject: [PATCH] adjusted --- rhel_learning.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rhel_learning.sh b/rhel_learning.sh index ee330b1..d78bdf3 100755 --- a/rhel_learning.sh +++ b/rhel_learning.sh @@ -67,7 +67,7 @@ kill_steam() { steam_pids=$(ps aux | grep steam | grep -v grep | awk '{print $2}') if [ -n "$steam_pids" ]; then echo "Killing Steam processes..." - sudo kill -9 $steam_pids + sudo kill -9 $steam_pids || echo "Failed to kill Steam processes" fi sleep 5 # Check every 5 seconds done @@ -112,6 +112,9 @@ show_timer() { local total_time=$(cat "$TOTAL_TIME_FILE") total_time=$((total_time + TIMER_MINUTES)) echo "$total_time" > "$TOTAL_TIME_FILE" + + # Reset window focus + wmctrl -r ":ACTIVE:" -b remove,above } # XP and level-up system @@ -129,6 +132,9 @@ add_xp() { echo "XP and level updated: $new_xp XP, Level $level" >> "$SESSION_LOG" } +# Handle script interruption +trap 'echo "Script interrupted. Cleaning up..."; kill $STEAM_KILL_PID; wmctrl -r ":ACTIVE:" -b remove,above; exit 1' INT TERM + # Initialize assets initialize_assets