Hyprland-dotfiles/scripts/launchvm.sh

49 lines
1.4 KiB
Bash
Raw Normal View History

2023-02-20 06:42:39 -05:00
#!/bin/bash
2023-03-09 03:25:31 -05:00
# _ _ __ ____ __
# | | __ _ _ _ _ __ ___| |__ \ \ / / \/ |
# | | / _` | | | | '_ \ / __| '_ \ \ \ / /| |\/| |
# | |__| (_| | |_| | | | | (__| | | | \ V / | | | |
# |_____\__,_|\__,_|_| |_|\___|_| |_| \_/ |_| |_|
#
#
# by Stephan Raabe (2023)
# -----------------------------------------------------
2023-02-20 06:42:39 -05:00
2023-02-22 10:13:17 -05:00
function countdown
{
local OLD_IFS="${IFS}"
IFS=":"
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START
while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))
printf "\r%02d:%02d:%02d" \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))
sleep 1
done
IFS="${OLD_IFS}"
echo " "
}
2023-03-30 12:02:07 -04:00
tmp=$(virsh --connect qemu:///system list | grep " win11 " | awk '{ print $3}')
if ([ "x$tmp" == "x" ] || [ "x$tmp" != "xrunning" ])
then
virsh --connect qemu:///system start win11
2023-04-04 05:22:52 -04:00
echo "Waiting 25 sec for Windows 11 startup..."
countdown "00:00:25"
2023-03-30 12:02:07 -04:00
fi
2023-02-22 10:13:17 -05:00
2023-02-20 06:42:39 -05:00
echo "Starting xfreerdp now..."
2023-02-20 09:57:18 -05:00
xfreerdp -grab-keyboard /t:"Windows 11" /v:192.168.122.42 /size:100% /d: /p:sancho /dynamic-resolution /gfx-h264:avc444 +gfx-progressive &
2023-02-23 09:56:40 -05:00
sleep 10
2023-02-20 06:42:39 -05:00
2023-02-22 10:13:17 -05:00
exit