Skip to content

Instantly share code, notes, and snippets.

@nvlled
Created May 22, 2019 11: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 nvlled/0a3c611862cb597722c05350bf61c276 to your computer and use it in GitHub Desktop.
Save nvlled/0a3c611862cb597722c05350bf61c276 to your computer and use it in GitHub Desktop.
Adds a temporary monitor resolution (linux)
#!/bin/bash
# example usage:
# ./add-monitor-resolution.sh VGA-1 1920 1080
# Note: replace VGA-1 with the name of your device
# run `xrandr --list-monitors` to see the name of your device
monitor=$1
width=$2
height=$3
modeline=`cvt $width $height | tail -n1 | cut --complement -d" " -f 1`
res=`echo $modeline | cut -d" " -f 1`
xrandr --newmode $modeline
xrandr --addmode VGA-1 $res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment