In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to achieve screen selection function in CentOS. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
[root@localhost ~] # vim load_xrandr.py# -.-coding:utf-8 -.-_ author__ = 'root' import os # list the monitor and resolution getScreens = os.popen ("vgas=$ (xrandr | grep" connected "); [$(echo" $vgas "| wc-l)-gt 1] & & {for i in $(echo" $vgas "| awk' {print $1}') Do echo $I xrandr | grep "$I connected"-A1 | awk-F "x"'{print $1}'| tail-n 1 | sed "s / g" done} "). Readlines () # handles the newline symbol for i in range (len (getScreens)): getScreens [I] = getScreens [I] .repla ce ("\ n ") ") # compare the higher resolution display if int (getScreens [1]) < int (getScreens [3]): bigger = getScreens [2] little = getScreens [0] else: bigger = getScreens [0] little = getScreens [2] # use the larger monitor as the current output. Os.popen (" xrandr-output% s-auto-output% s-off "% (bigger, little))
After writing this code, you can output the screen to a larger screen as long as you load it when you log in.
[root@localhost ~] # vim .bashrc [$(xrandr | grep "connected" | wc-l)-gt 1] & & {/ usr/local/Python-2.7.8/bin/python / root/load_xrandr.py} this is how screen selection is implemented in the CentOS shared by Xiaobian. If you happen to have similar doubts, please refer to the above analysis for understanding. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.