-
-
Save jkap/6101607 to your computer and use it in GitHub Desktop.
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 | |
#Original author: Travis Gibson | |
#Modified for the Chromebook Pixel by Josh Kaplan | |
#This script requires an argument for the resolution width | |
if [ -z "$1" ]; then | |
echo "Usage: Res.sh <resolution_width>"; | |
exit 1; | |
fi | |
erg=$( echo "$1") | |
check=$(xrandr -q | grep eDP1 | cut -d " " -f 3 | cut -d "x" -f 1) | |
if [ "$erg" -eq "$check" ]; then | |
echo "The screen is already at this resolution" | |
exit 1; | |
fi | |
resolution=$(xrandr -q | grep eDP1 | cut -d " " -f 3); | |
if [ "$resolution" != "2560x1700+0+0" ]; then | |
xrandr --output DP-2 --scale 1x1; | |
#Necessary to work around an issue where re-scaling | |
#only works if the scale is set to 1x1 | |
sleep 3; | |
fi | |
scale_w=$(echo "scale=4; $1/2560" | bc; exit ); | |
arg=$(echo "$scale_w""x""$scale_w") | |
xrandr --output eDP1 --scale $arg | |
sleep 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment