linux螢幕解析度


最近為我的ibm x230 買了一個vga to hdmi的轉換器,沒想到轉換後只有1024x768,上網找了解答,解釋如下:
先用xrandr指令尋找是誰有問題:

nathan@ThinkPad-X230:~/screen$ xrandr
Screen 0: minimum 320 x 200, current 1360 x 768, maximum 16384 x 16384
LVDS-1 connected (normal left inverted right x axis y axis)
   1366x768      60.02 +
   1360x768      59.80    59.96  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   800x512       60.17  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   720x450       59.89  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   680x384       59.80    59.96  
   640x400       59.88    59.98  
   576x432       60.06  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32  
VGA-1 connected primary 1360x768+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

可以發現是VGA-1有問題。
接下來使用cvt跟xrandr,新增1360x768的解析度。

nathan@ThinkPad-X230:~$ cvt 1360 768 60
# 1360x768 59.80 Hz (CVT) hsync: 47.72 kHz; pclk: 84.75 MHz
Modeline "1360x768_60.00"   84.75  1360 1432 1568 1776  768 771 781 798 -hsync +vsync
nathan@ThinkPad-X230:~$ xrandr --newmode "1360x768_60.00"   84.75  1360 1432 1568 1776  768 771 781 798 -hsync +vsync
nathan@ThinkPad-X230:~$ xrandr --addmode VGA-1 "1360x768_60.00"
nathan@ThinkPad-X230:~$ xrandr --output VGA-1 --mode  1360x768_60.00

接下來寫成shell檔,並設定開機時執行:

vim /etc/systemd/system/auto_run_screen.service

auto_run_screen.service的內容如下:

[Unit]
Description=Run a Custom Script screen resolution  at Startup
After=default.target
[Service]
ExecStart=/home/nathan/screen/screen_resolution.sh
[Install]
WantedBy=default.target

至於screen_resolution.sh的內容如下:

xrandr --newmode "1360x768_60.00"   84.75  1360 1432 1568 1776  768 771 781 798 -hsync +vsync
xrandr --addmode VGA-1 "1360x768_60.00"
xrandr --output VGA-1 --mode  1360x768_60.00

在寫好auto_run_screen.service後,還要執行以下指令:

$ systemctl daemon-reload
$ systemctl enable auto_run_screen.service

收工。

Reference

Linux 螢幕解析度問題
Linux系統如何設定開機自動執行指令碼?

#linux #螢幕解析度






你可能感興趣的文章

Modelsim 基礎教學

Modelsim 基礎教學

Day 100

Day 100

.Net MVC authorization Controller and Workcontext extension in razor view

.Net MVC authorization Controller and Workcontext extension in razor view






留言討論