ubuntu自定義分辨率


首先說下為啥要專門敲個文章來說明這個問題,因為我最近入手了一台分辨率為3200*1800的高分辨率筆記本,但使用的時候發現現在的操作系統及其諸多軟件對高分辨率屏幕的支持真的是太爛,字體發虛或者變得非常小,而我又不想把分辨率調回低分辨率,這樣就浪費了屏幕。

首先我想在win10下使用虛擬機VMware Workstation 安裝Ubuntu,然后以便在linux上developing,但是發現裝完之后分辨率顯示效果非常差。情況如下:

1、

筆記本:13.3寸,分辨率3200*1800

主機操作系統:win10

虛擬機:VMware Workstation 11

從機操作系統:Ubuntu14.04.03 (Unity)

裝完發現Ubuntu 默認分辨率800*600,並且Setting——>Display(系統設置——>顯示)中無3200*1800的分辨率可選擇,所以自己自定義分辨率:

解決方案:xrandr命令。

 首先,直接運行xrandr查看下分辨率的情況:
 
 標星號的那行就是我正在使用的分辨率(800*600)。
 下面用cvt命令生成一個modeline,為后續添加分辨率作准備:
 
 

 
再運行xrandr --newmode來創建一個分辨率模式,使用“Modeline”后的內容(--rmmode刪除這個模式)
 

 接着用xrandr --addmode把這個模式添加到顯示器上(--delmode把這個模式從該顯示器上移除),再次使用xrandr可發現已經添加上去了:

 
最后是應用這個模式:
命令: xrandr --output VGA1 --mode "3200x1800_60.00"
使用命令后,可以發現字體都變得非常小,看不清了,如下:

 用xrandr查看一下,可以發現分辨率已經修改為3200*1800了:
 
wang@ubuntu:~$ xrandr
Screen 0: minimum 1 x 1, current 3200 x 1800, maximum 8192 x 8192
Virtual1 connected primary 3200x1800+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
800x600 60.0 + 60.3 
2560x1600 60.0 
1920x1440 60.0 
1856x1392 60.0 
1792x1344 60.0 
1920x1200 59.9 
1600x1200 60.0 
1680x1050 60.0 
1400x1050 60.0 
1280x1024 60.0 
1440x900 59.9 
1280x960 60.0 
1360x768 60.0 
1280x800 59.8 
1152x864 75.0 
1280x768 59.9 
1024x768 60.0 
640x480 59.9 3200x1800_60.00 60.0* 
Virtual2 disconnected (normal left inverted right x axis y axis)
Virtual3 disconnected (normal left inverted right x axis y axis)
Virtual4 disconnected (normal left inverted right x axis y axis)
Virtual5 disconnected (normal left inverted right x axis y axis)
Virtual6 disconnected (normal left inverted right x axis y axis)
Virtual7 disconnected (normal left inverted right x axis y axis)
Virtual8 disconnected (normal left inverted right x axis y axis)

但是字體太小了,所以接下來我們需要調大字體,非常簡單,直接在display中設置,如下:

把Scale for menu and title bar的數值調成2.5,發現,效果好很多。


<<<---------------------------------------------------------------

  到此,我的屏幕看上去就清爽多了。

 

不過,關機重新開機后此設置有時候就沒有了,又恢復到原來的分辨率了。

現在把設置新分辨率的命令寫到一個sh腳本中,如果分辨率恢復到原來的自動執行此shell文件就可以了。

如何添加自啟動程序請參考:Ubuntu添加開機自動啟動程序方法

shell代碼如下:

#!/bin/bash
# set screen resolution to 3200x1800
cvt 3200 1800
xrandr --newmode "3200x1800_60.00"  492.00  3200 3456 3800 4400  1800 1803 1808 1865 -hsync +vsync
xrandr --addmode Virtual1 "3200x1800_60.00"
xrandr --output Virtual1 --mode "3200x1800_60.00"

搞定了。。

 

2、下面講下在Gnome 3桌面系統下如何設置分辨率:

Ubuntu Gnome版本為例:

方法基本差不多,只有一步不同(設置字體大小),Gnome 3設置字體大小,需要一條shell命令,如下:

參考:How to properly change window scalling factor in gnome

gsettings set org.gnome.desktop.interface scaling-factor 2

立馬發現字體變大,果然效果清晰很多

 

 

將Gnome下shell代碼如下:

 

#!/bin/bash
# set screen resolution to 3200x1800
cvt 3200 1800
xrandr --newmode "3200x1800_60.00"  492.00  3200 3456 3800 4400  1800 1803 1808 1865 -hsync +vsync
xrandr --addmode Virtual1 "3200x1800_60.00"
xrandr --output Virtual1 --mode "3200x1800_60.00"
gsettings set org.gnome.desktop.interface scaling-factor 3

同樣設置自啟動,問題解決

 擴展:
實際上對Gnome 3桌面系統,還可以通過工具 Gnome Tweak Tool 來自定義更多東西
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM