Skip to content

Instantly share code, notes, and snippets.

@alepez
Created April 8, 2020 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alepez/6f06ad44b637eca934be42d5641dd18e to your computer and use it in GitHub Desktop.
Save alepez/6f06ad44b637eca934be42d5641dd18e to your computer and use it in GitHub Desktop.
i3wm fix virtualbox resolution

VirtualBox gust screen resolution doesn't work well under i3wm, sometime it get stuck at some strange resolution.

This script can fix the window size.

From the guest side, we use VBoxManage to tell the guest that a new resolution is available.

Window is made floating, then the border is removed (it count as width/height), then the window is resized.

#!/bin/bash

machine="${1}"
width="${2}"
height="${3}"

VBoxManage controlvm "${1}" setvideomodehint ${width} ${height} 32
i3-msg "[class=\"VirtualBox Machine\"] floating enable"
i3-msg "[class=\"VirtualBox Machine\"] border none"
i3-msg "[class=\"VirtualBox Machine\"] resize set ${width} ${height}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment