Created
May 23, 2017 14:47
-
-
Save mrbuk/6939680bef0c9753c7a600ffc48cc9a9 to your computer and use it in GitHub Desktop.
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 | |
# if the notebook lid is closed the the display is identified as "DisplayPort-0". If the notebook lid is open it is identified as "DisplayPort-1" | |
# in case of a closed lid "DisplayPort-1 disconnected" can be found in xrandr output. | |
# default to notebook lid is open | |
TARGET_DISPLAY="DisplayPort-1" | |
xrandr | grep 'DisplayPort-1 disconnected' > /dev/null | |
if [ "$?" == 0 ]; then | |
# disconnected was found so we need to use "DisplayPort-0" instead | |
TARGET_DISPLAY="DisplayPort-0" | |
fi | |
xrandr | grep '4096x2160_50' | |
if [ "$?" != "0" ]; then | |
xrandr --newmode "4096x2160_50" 526.170 4096 4632 4696 4736 2160 2208 2216 2222 +hsync +vsync || exit 1 | |
xrandr --addmode $TARGET_DISPLAY 4096x2160_50 || exit 1 | |
fi | |
xrandr | grep '4096x2160_60' | |
if [ "$?" != "0" ]; then | |
xrandr --newmode "4096x2160_60" 556.730 4096 4104 4136 4176 2160 2208 2216 2222 +hsync +vsync || exit 1 | |
xrandr --addmode $TARGET_DISPLAY 4096x2160_60 || exit 1 | |
fi | |
# set HiDPI resolution by setting to highest possible resolution and changing text-scaling-factor | |
xrandr -s 4096x2160_60 || exit 1 | |
TEXT_SCALE_FACTOR=$(gsettings get org.gnome.desktop.interface text-scaling-factor) | |
if [ "$TEXT_SCALE_FACTOR" != "1.5" ]; then | |
gsettings set org.gnome.desktop.interface text-scaling-factor 1.5 || exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment