不灭的焱

革命尚未成功,同志仍须努力下载JDK17

作者:Albert.Wen  添加时间:2015-12-14 23:35:32  修改时间:2024-04-18 17:05:22  分类:Linux软件安装/参数优化  编辑

最近安装了新的Deepin系统,但在分辨率问题上纠结了好久,现在记录下解决方法,供大家参考。

我使用的是联想笔记本外接一个1920x1080屏幕,但系统无法支持1920x1080的分辨率。查了很多资料,但结果都不是很满意。Deepin系统其实是Unbutu一系列的操作系统在Linux家族中已经算桌面环境比较好的。

众所周知,Linux系统普遍对显卡驱动支持不是很好,所以我选择使用扩展分辨率模式的方法。

 

首先,使用xrandr命令查看当前分辨率:

# xrandr
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
LVDS1 connected primary (normal left inverted right x axis y axis)
   1366x768      60.00 +
   1360x768      59.80    59.96  
   1024x768      60.00  
   800x600       60.32    56.25  
   640x480       59.94  
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
VGA1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768      60.00*+  
   800x600       60.32    56.25  
   848x480       60.00  
   640x480       59.94  
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

 

可以看到,VGA1就是我们的扩展屏。上面每一行都是一个支持的分辨率,其中带*的就是当前使用的分辨率。为了支持1920x1080分辨率,我们增加一个分辨率模式:

# cvt 1920 1080
1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

 

增加新的模式:

#xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

 

将新模式绑定到VGA1:

#xrandr --addmode VGA1 "1920x1080_60.00" 

 

启用模式:

#xrandr --output VGA1 --mode "1920x1080_60.00"

 

OK,分辨率修改成功!可以查看现在的分辨率:

#xrandr
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
LVDS1 connected primary (normal left inverted right x axis y axis)
   1366x768      60.00 +
   1360x768      59.80    59.96  
   1024x768      60.00  
   800x600       60.32    56.25  
   640x480       59.94  
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
VGA2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1920x1080     59.96*+
   1024x768      60.00  
   800x600       60.32    56.25  
   848x480       60.00  
   640x480       59.94  
   1920x1080_60.00  59.96  
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

 

这种方法有个缺陷,就是每次关机都会重置,如果每次开机都那么写一遍岂不是很麻烦?别着急,我们有更好的方法,可以将上面的命令写成一个脚本myxrandr,代码如下:

#!/bin/bash
#the code for xrandr 1920x1080
echo "---------------" 
xdrandr
echo "---------------" 
cvt 1920 1080
#add new mode 
xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
xrandr --addmode VGA1 "1920x1080_60.00"
#use mode
xrandr --output VGA1 --mode "1920x1080_60.00"
echo "sucessed!"
echo "---------------" 
xdrandr
echo "---------------" 

 

别急!是不是无法执行?这是因为程序没有权限,需要加上执行权限:

#chmod u+x myxrandr

 

好了,每次需要用显示器的时候执行这个程序就可以了。

那么,如果我每次都要用这个屏幕怎么办?每次都要运行程序还是很麻烦?

这个简单。Linux系统在开机后都会执行一个rc.local文件,只需要把上面的脚本加入 /etc/init.d/rc.local 最后就可以了(记住要放在exit之前)。

好了,Deepin愉快!

 

摘自:https://blog.csdn.net/smilematch/article/details/50482530

 

 


 

公司电脑 ThinkPad T470p  屏幕分辨率设置脚本:

screen.sh

#!/bin/bash

echo "---------------" 
xrandr
echo "---------------" 
xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
xrandr --addmode HDMI-1 "1920x1080_60.00"
xrandr --output HDMI-1 --mode "1920x1080_60.00"
echo "sucessedпјЃ"
echo "---------------"
xrandr
echo "---------------"