CentOS "screen selection" function (display)

Source: Internet
Author: User

CentOS "screen selection" function (display)

A CentOS6.5 is installed in the notebook, and the notebook usually has an external display. After the system is installed, the "screen selection" function (display) will never be found when the mouse is shaking for a while ), the following code is available in anger.

[root@localhost~] #vimload_xrandr.py #-.-coding:utf-8-.- __author__ = 'root' import os # List displays and resolutions getScreens = os.popen( """ vgas=$(xrandr|grep"connected"); [$(echo"$vgas"|wc-l)-gt1]&&{ foriin$(echo"$vgas"|awk'{print$1}'); do echo$i xrandr|grep"$iconnected"-A1|awk-F"x"'{print$1}'|tail-n1|sed"s///g" done }""" ).readlines() # Handling line breaks for i in range ( len (getScreens)):getScreens[i] = getScreens[i].replace( "\n" ,"") # Display with a higher resolution than the output if int (getScreens[ 1 ])< int (getScreens[ 3 ]): bigger = getScreens[ 2 ] little = getScreens[ 0 ] else : bigger = getScreens[ 0 ] little = getScreens[ 2 ] # Use a large display as the current output. os.popen( "xrandr--output%s--auto--output%s--off" % (bigger,little))

After writing this code, you only need to load it at login, and the screen can be output to a relatively large display.

[root@localhost~] #vim.bashrc [$(xrandr| grep "connected" | wc -l)-gt1]&&{ /usr/local/Python-2 .7.8 /bin/python /root/load_xrandr .py }

Later, we found that the Display is in the System-> Preferrences panel.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.