Automatic best resolution with xrandr

If you like me you have a big screen with your laptop and wants to automate when your X session start to get the best resolution, you can use that script :

[code lang=”bash”]

function get_resolutions() {
xrandr|while read -a line;do
RES=”${line[1]}x${line[3]} ”
[[ ${RES} != [0-9]* ]] && continue
echo ${RES}

for res in $(get_resolutions);do
[[ $_res -ge ${_BEST_RES} ]] && {
xrandr -s ${BEST_RES}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.