Created
January 31, 2020 04:15
-
-
Save VitaliyKuznetsov/4150f9ec4d6d5f7c77faf01ee532c7b5 to your computer and use it in GitHub Desktop.
Set Resolution on VGA1 output at closer available to 1366x768(60Hz) by cvt and xrandr
This file contains 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 | |
# Check session type (that reasonable only with X11 sessions) | |
[ "$XDG_SESSION_TYPE" = x11 ] || exit 0 | |
# Parse data from cvt output (parsing Modeline for xrand) | |
myNewMode=$(cvt 1366 768 60 | grep -oP 'Modeline\K.*') | |
myNewModeName=$(echo $myNewMode | grep -oP '"\K[^"\047]+(?=["\047])' ) | |
myModeParams=$(echo $myNewMode | grep -oP '"\K .*$') | |
# Create new mode from parsed Modeline | |
xrandr --newmode $myNewModeName $myModeParams | |
# Add mode to VGA1 output | |
xrandr --addmode VGA1 $myNewModeName | |
# Set new added mode as active on VGA1 output | |
xrandr --output VGA1 --mode $myNewModeName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment