diff --git a/surface-res b/surface-res new file mode 100755 index 0000000..39a1b7d --- /dev/null +++ b/surface-res @@ -0,0 +1,29 @@ +#! /usr/bin/env bash +# Janky ass resolution switching for Ubuntu. Kinda works kinda doesn't. +# Mostly for lowering the res while playing games in wine that can't scale + +OUTPUT="eDP-1" +WIDTH=2736 +HEIGHT=1824 + +WIDTH_HALF=$(expr $WIDTH / 2) +HEIGHT_HALF=$(expr $HEIGHT / 2) +NATIVE="${WIDTH}x${HEIGHT}" +HALF="${WIDTH_HALF}x${HEIGHT_HALF}" + + +if [[ $1 == "low" ]] +then + echo "Going low" + xrandr --output eDP-1 --mode $NATIVE --fb $HALF --panning $HALF --scale-from $HALF + gsettings set org.gnome.desktop.interface scaling-factor 2 + gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gdk/WindowScalingFactor': <1>}" +elif [[ $1 == "high" ]] +then + echo "Going high" + xrandr --output eDP-1 --mode $NATIVE --fb $NATIVE --panning $NATIVE --scale-from $NATIVE + gsettings set org.gnome.desktop.interface scaling-factor 1 + gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gdk/WindowScalingFactor': <2>}" +else + echo "USAGE: ${0} [low|high]" +fi