Hyprland-dotfiles/scripts/launchvm.sh

36 lines
1.3 KiB
Bash
Raw Normal View History

2023-06-07 02:51:31 -04:00
#!/bin/bash
# _ _ __ ____ __
# | | __ _ _ _ _ __ ___| |__ \ \ / / \/ |
# | | / _` | | | | '_ \ / __| '_ \ \ \ / /| |\/| |
# | |__| (_| | |_| | | | | (__| | | | \ V / | | | |
# |_____\__,_|\__,_|_| |_|\___|_| |_| \_/ |_| |_|
#
#
# by Stephan Raabe (2023)
# -----------------------------------------------------
2023-09-22 11:45:38 -04:00
if [ -f ~/private/win11-credentials.sh ]; then
echo "Credential file exists. Using the file."
source ~/private/win11-credentials.sh
else
win11user="USER"
win11pass="PASS"
2023-10-04 11:05:17 -04:00
vmip="192.168.122.44"
2023-09-22 11:45:38 -04:00
fi
2023-10-04 11:05:17 -04:00
2023-06-07 02:51:31 -04:00
tmp=$(virsh --connect qemu:///system list | grep " win11 " | awk '{ print $3}')
2023-09-22 11:45:38 -04:00
2023-06-07 02:51:31 -04:00
if ([ "x$tmp" == "x" ] || [ "x$tmp" != "xrunning" ])
then
2023-10-09 09:54:11 -04:00
echo "Virtual Machine win11 is starting now... Waiting 30s before starting xfreerdp."
notify-send "Virtual Machine win11 is starting now..." "Waiting 30s before starting xfreerdp."
2023-06-07 02:51:31 -04:00
virsh --connect qemu:///system start win11
2023-10-04 11:05:17 -04:00
sleep 30
2023-06-07 02:51:31 -04:00
else
2023-09-18 13:13:36 -04:00
notify-send "Virtual Machine win11 is already running." "Launching xfreerdp now!"
2023-06-07 02:51:31 -04:00
echo "Starting xfreerdp now..."
fi
2023-10-04 11:05:17 -04:00
xfreerdp -grab-keyboard /v:$vmip /size:100% /cert-ignore /u:$win11user /p:$win11pass /d: /dynamic-resolution /gfx-h264:avc444 +gfx-progressive &