Update rustdesk.sh

This commit is contained in:
Spencer Flagg 2024-02-05 10:56:08 +00:00
parent 5a6955c4b7
commit 913a3f3b73

View file

@ -3,6 +3,7 @@
# Variables
RUSTDESK_URL="https://github.com/rustdesk/rustdesk/releases/download/1.2.3/rustdesk-1.2.3-x86_64.deb"
RUSTDESK_DEB="rustdesk-1.2.3-x86_64.deb"
ID_SERVER="172.232.132.62"
# Check for RustDesk installation and remove it if present
if dpkg -l | grep -qw rustdesk; then
@ -40,19 +41,9 @@ fi
echo "Starting RustDesk..."
# Start RustDesk and attempt to bring its window to the foreground
if ! pgrep -x "rustdesk" > /dev/null; then
rustdesk &
sleep 2 # Give RustDesk a moment to start
# Attempt to focus the RustDesk window. This method may need adjustment based on the desktop environment.
WINDOW_ID=$(xdotool search --onlyvisible --class rustdesk | head -1)
if [ ! -z "$WINDOW_ID" ]; then
xdotool windowactivate "$WINDOW_ID"
else
echo "RustDesk started but could not focus the window automatically."
fi
else
echo "RustDesk is already running."
fi
rustdesk
echo "$ID_SERVER" | xclip -selection clipboard
echo "Cleaning up..."
rm -f "$RUSTDESK_DEB"