使用命令xrandr设置当前系统的显示分辨率及显示的旋转脚本

/*********************************************************************
 * Author  : Samson
 * Date    : 06/15/2014
 * Test platform:
 *              Mint 15-3.8.13.13
 *              GNU bash, version 4.2.45
 * *******************************************************************/

#!/bin/bash
echo "try to set 800x600"
 xrandr -s 8
sleep 10
echo "try to set 1680x1050"
xrandr -s 2
sleep 10
echo "try to set 1440x900"
xrandr -s 4
sleep 10
echo "try to set 1280x1024"
xrandr -s 3
sleep 10
echo "try to set 1024x768"
 xrandr -s 6
sleep 10
echo "try to set 1920x1080"
 xrandr -s 0
sleep 10
以上的-s后的參数值后跟的数值是相应的显示配置中的项从上至下的索引號,索引號从0開始,这个须要打开的你的电脑的“显示”属性配置对话框进行查看。例如以下图,若是xrandr -s 0相应的就不是 1920x1080,而是1600*900了。
下面是使用命令进行显示器旋转的配置脚本:
echo "try to set left"
xrandr -o leftsleep 3
echo "try to set right"
xrandr -o right
sleep 3
echo "try to set inverted "
xrandr -o inverted
sleep 3
echo "try to set normal"
xrandr -o normal
sleep 3
原文地址:https://www.cnblogs.com/blfshiye/p/3798964.html