From a35349340f6f89e5f7d373e9d9faad1a221ca565 Mon Sep 17 00:00:00 2001 From: joy Date: Thu, 11 Jul 2024 22:38:18 +0200 Subject: [PATCH] vm for laptop --- home/hyprland/vm.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/home/hyprland/vm.sh b/home/hyprland/vm.sh index b9cc82f..ddd0065 100755 --- a/home/hyprland/vm.sh +++ b/home/hyprland/vm.sh @@ -1,3 +1,24 @@ +#!/bin/bash + +# Start the virtual machine named "Windows" using virsh virsh --connect qemu:///system start Windows -sleep 3 -xfreerdp -grab-keyboard /v:192.168.122.93 /u:joy /p:1 /size:100% /d: /dynamic-resolution /gfx-h264:avc444 +gfx-progressive + +# Wait for 3 seconds to allow the VM to start up +sleep 3 + +# Get the hostname of the current machine +hostname=$(hostname) + +# Set the IP address based on the hostname +if [ "$hostname" == "desktop" ]; then + ip="192.168.122.93" +elif [ "$hostname" == "laptop" ]; then + ip="192.168.122.29" +else + echo "Unknown hostname: $hostname" + exit 1 +fi + +# Start an RDP session to the VM using xfreerdp +xfreerdp -grab-keyboard /v:$ip /u:joy /p:1 /size:100% /d: /dynamic-resolution /gfx-h264:avc444 +gfx-progressive +