Skip to content

Instantly share code, notes, and snippets.

@multiplemonomials
Last active February 22, 2020 22:44
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 multiplemonomials/222840296f0e10404e63b93ee278af7e to your computer and use it in GitHub Desktop.
Save multiplemonomials/222840296f0e10404e63b93ee278af7e to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script will set your Linux desktop to use a custom screen resolution.
# Set your resolution in the variables below, and then run the script each time your VM boots.
# Bam! No more annoying issues with your VM screen being too big or too small!
#
# Author: CP Jamie, with some help from StackOverflow
width=1280
height=1024
refreshrate=60
res_name="${width}x${height}_${refreshrate}hz"
res_modeline=$(cvt $width $height ${refreshrate} | tail -1 | cut -d ' ' -f 3-)
monitor_name=$(xrandr --listactivemonitors | tail -1 | cut -d ' ' -f 6)
xrandr --newmode $res_name $res_modeline
xrandr --addmode $monitor_name $res_name
xrandr --output $monitor_name --mode $res_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment