Skip to content

Instantly share code, notes, and snippets.

@kasramp
Last active September 1, 2022 12:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kasramp/1ef67995fe87430dcf4cf66763340610 to your computer and use it in GitHub Desktop.
Save kasramp/1ef67995fe87430dcf4cf66763340610 to your computer and use it in GitHub Desktop.
Set OpenBSD screen resolution on Virtualbox
#!/bin/sh
# inspired by https://www.tumfatig.net/20190131/customized-resolution-for-openbsd-in-virtualbox/
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
mkdir -p /etc/X11/xorg.conf.d
cat << EOF > /etc/X11/xorg.conf.d/00-virtualbox-monitor.conf
Section "Device"
Identifier "VirtualBox-Card"
Driver "vesa"
VendorName "InnoTek"
BoardName "VirtualBox Graphics Adapter"
EndSection
Section "Monitor"
Identifier "VirtualBox-Monitor"
VendorName "InnoTek"
ModelName "VirtualBox Screen"
HorizSync 1.0 - 1000.0
VertRefresh 1.0 - 1000.0
EndSection
Section "Screen"
Identifier "VirtualBox-Screen"
Device "VirtualBox-Card"
Monitor "VirtualBox-Monitor"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
#Modes "1368x768" "1360x768" "1280x800" "1024x768"
Modes "$1"
EndSubSection
EndSection
EOF
echo "Success - reboot your system"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment