Last active
August 15, 2019 16:58
-
-
Save jfeilbach/4be584b733e136bf43aa0368693a8b2a to your computer and use it in GitHub Desktop.
fix display resolution in vm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Fix resolution lost during reboot | |
cmd=$(xrandr --listmonitors | grep Virtual | awk '{ print $3 }') | |
if [[ "${cmd}" == "2560/677x1440/381+0+0" ]]; then | |
res=$(gtf 2560 1440 60 | grep Modeline | sed s/Modeline\ //) | |
base=$(gtf 2560 1440 60 | grep Modeline | awk '{ print $2 }') | |
xrandr --newmode ${res} | |
xrandr --addmode Virtual1 ${base} | |
xrandr --output Virtual1 --mode ${base} | |
else | |
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync | |
xrandr --addmode Virtual1 "1920x1080_60.00" | |
xrandr -s 1920x1080_60.00 | |
fi | |
# Laptop display | |
# xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync | |
# xrandr --addmode Virtual1 "1920x1080_60.00" | |
# xrandr -s 1920x1080_60.00 | |
# Asus P278Q external monitor version via DisplayPort | |
# xrandr --newmode "2560x1440_60.00" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync | |
# xrandr --addmode Virtual1 "2560x1440_60.00" | |
# xrandr --output Virtual1 --mode "2560x1440_60.00" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment