From 11e3355fce7c99f62db9e98c613d68be41e740af Mon Sep 17 00:00:00 2001 From: klein panic Date: Tue, 22 Oct 2024 21:30:39 -0400 Subject: [PATCH] Initial Commit --- skippy-xd-scripts/close-skippy.sh | 22 ++++++++++++++ skippy-xd-scripts/skippy-manager.sh | 45 +++++++++++++++++++++++++++++ skippy-xd-scripts/start-skippy.sh | 7 +++++ switch_tags | 1 + 4 files changed, 75 insertions(+) create mode 100755 skippy-xd-scripts/close-skippy.sh create mode 100755 skippy-xd-scripts/skippy-manager.sh create mode 100755 skippy-xd-scripts/start-skippy.sh create mode 160000 switch_tags diff --git a/skippy-xd-scripts/close-skippy.sh b/skippy-xd-scripts/close-skippy.sh new file mode 100755 index 0000000..eabe6d9 --- /dev/null +++ b/skippy-xd-scripts/close-skippy.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Check if skippy-xd is currently running +SKIPPY_PID=$(pgrep -x "skippy-xd") + +if [ -n "$SKIPPY_PID" ]; then + # Capture the currently active window before killing skippy-xd + PREV_WINDOW=$(xdotool getwindowfocus) + + # Kill skippy-xd cleanly + pkill -x skippy-xd + + # Wait until skippy-xd is fully terminated + while pgrep -x "skippy-xd" > /dev/null; do + sleep 0.1 + done + + # Refocus the previously active window + if [ -n "$PREV_WINDOW" ]; then + xdotool windowactivate "$PREV_WINDOW" + fi +fi diff --git a/skippy-xd-scripts/skippy-manager.sh b/skippy-xd-scripts/skippy-manager.sh new file mode 100755 index 0000000..2499c42 --- /dev/null +++ b/skippy-xd-scripts/skippy-manager.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Check if an argument was passed +if [ $# -ne 1 ]; then + echo "Usage: $0 {start|stop}" + exit 1 +fi + +# Define the actions for start and stop +case "$1" in + start) + # Check if skippy-xd is currently running + if ! pgrep -x "skippy-xd" > /dev/null; then + # Start skippy-xd + skippy-xd > /dev/null 2>&1 & + fi + ;; + stop) + # Check if skippy-xd is currently running + SKIPPY_PID=$(pgrep -x "skippy-xd") + + if [ -n "$SKIPPY_PID" ]; then + # Capture the currently active window before killing skippy-xd + PREV_WINDOW=$(xdotool getwindowfocus) + + # Kill skippy-xd cleanly + pkill -x skippy-xd + + # Wait until skippy-xd is fully terminated + while pgrep -x "skippy-xd" > /dev/null; do + sleep 0.1 + done + + # Refocus the previously active window + if [ -n "$PREV_WINDOW" ]; then + xdotool windowactivate "$PREV_WINDOW" + fi + fi + ;; + *) + echo "Invalid argument: $1" + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac diff --git a/skippy-xd-scripts/start-skippy.sh b/skippy-xd-scripts/start-skippy.sh new file mode 100755 index 0000000..3428ca1 --- /dev/null +++ b/skippy-xd-scripts/start-skippy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Check if skippy-xd is currently running +if ! pgrep -x "skippy-xd" > /dev/null; then + # Start skippy-xd + skippy-xd & +fi diff --git a/switch_tags b/switch_tags new file mode 160000 index 0000000..4eca228 --- /dev/null +++ b/switch_tags @@ -0,0 +1 @@ +Subproject commit 4eca2286682a32f266c7124715a6f279ed7bd004