|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!在条记本上装了个CentOS6.5,平常条记本都外接一个显现器,这回体系装好了以后,鼠标乱晃了一小会一直找不到“屏幕选择”功效(display),一怒之下就有了上面这段代码.
[size=1em][size=1em][root@localhost~]#vimload_xrandr.py
<divstyle="padding:0px;margin:0px;color:rgb(80,80,80);font-family:宋体,ArialNarrow,arial,serif;font-size:14px;line-height:28px;"><divclass="syntaxhighlighterpython"id="highlighter_122909"style="width:720px;padding:0px!important;margin:0.3em0px!important;border-radius:0px!important;border:0px!important;bottom:auto!important;float:none!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow-y:visible!important;overflow-x:auto!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;box-sizing:content-box!important;font-family:Consolas,BitstreamVeraSansMono,CourierNew,Courier,monospace!important;font-size:1em!important;min-height:inherit!important;background-image:none!important;background-attachment:initial!important;background-size:initial!important;background-origin:initial!important;background-clip:initial!important;background-position:initial!important;background-repeat:initial!important;"><divclass="container"style="padding:0px!important;margin:0px!important;border-radius:0px!important;border:0px!important;bottom:auto!important;float:none!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:relative!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;box-sizing:content-box!important;font-size:1em!important;min-height:inherit!important;background:none!important;">[size=1em]#-.-coding:utf-8-.-
[size=1em]__author__=root
[size=1em]
[size=1em]importos
[size=1em]
[size=1em]#列出显现器及分辩率
[size=1em]getScreens=os.popen("""
[size=1em]vgas=$(xrandr|grep"connected");
[size=1em]
[size=1em][$(echo"$vgas"|wc-l)-gt1]&&{
[size=1em]foriin$(echo"$vgas"|awk{print$1});
[size=1em]do
[size=1em]echo$i
[size=1em]xrandr|grep"$iconnected"-A1|awk-F"x"{print$1}|tail-n1|sed"s///g"
[size=1em]done
[size=1em]}""").readlines()
[size=1em]
[size=1em]#处置换行标记
[size=1em]foriinrange(len(getScreens)):getScreens=getScreens.replace("
","")
[size=1em]
[size=1em]#比对出分辩率较年夜的显现器
[size=1em]ifint(getScreens[1])<int(getScreens[3]):
[size=1em]bigger=getScreens[2]
<divclass="linenumber24index23alt1"style="white-space:nowrap;padding:0px1em!important;margin:0px!important;border-radius:0px!important;border:0px!important;bottom:auto!important;float:none!important;left:auto!important;line-height:1.1em!important;outline:0px!important;overflow:visible!important;position:static!important;right:auto!important;top:auto!important;vertical-align:baseline!important;width:auto!important;box-sizing:content-box!important;font-size:1em!important;min-height:inherit!important;background-image:none!important;background-attachment:initial!important;background-size:initial!important;background-origin:initial!important;background-clip:initial!important;background-position:initial!important;background-repeat:initial!important;"> |
|