Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,20 @@ Commands:
If you need help on any subcommand, run `hypy.py COMMAND --help`.
Further details on subcommands: https://github.com/avanzzzi/hypy/wiki

## Window resizing on Linux/Mac
On Linux and Mac, hypy passes `/smart-sizing` to xfreerdp, so the VM window can be freely resized. The image will scale to fit the window without black areas.

For **true dynamic resolution** (the VM display actually changes resolution to match the window size), Hyper-V Enhanced Session must be enabled on the host. Run the following on the Windows Hyper-V host as Administrator:

```powershell
Set-VMHost -EnableEnhancedSessionMode $true
# or
Set-VM -VMName "YourVMName" -EnhancedSessionTransportType HvSocket
```

> **Note:** Linux guest VMs also require `xrdp` installed inside the VM to support Enhanced Session.

Once Enhanced Session is active, replace `/smart-sizing` with `/dynamic-resolution` in `hypy/modules/hvclient.py` for the best experience.

## tests
A tox.ini file is included for execution of style check and unit tests.
6 changes: 5 additions & 1 deletion hypy/modules/hvclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def connect(vm_id: str, vm_name: str, vm_index: str):
passw = config['pass']
host = config['host']

if platform.uname()[0] == "Windows":
is_windows = platform.uname()[0] == "Windows"
if is_windows:
freerdp_bin = "wfreerdp.exe"
else:
freerdp_bin = "xfreerdp"
Expand All @@ -39,6 +40,9 @@ def connect(vm_id: str, vm_name: str, vm_index: str):
'/t:{} [{}] {}'.format(host, vm_index, vm_name),
'/cert-ignore']

if not is_windows:
cmd.append('/smart-sizing')

try:
handle = Popen(cmd, stdout=DEVNULL, stderr=PIPE)
errs = handle.communicate(timeout=5)[1]
Expand Down