Compton本身不直接配置分辨率
Compton是一款窗口合成器(負責窗口特效、透明度和合成),其配置文件(~/.config/compton.conf)主要管理窗口動畫、陰影、透明度等視覺效果,不包含分辨率設置選項。分辨率調整需通過系統級的顯示工具(如xrandr)完成,以下是具體步驟:
打開終端,運行以下命令查看已連接的顯示器名稱(如HDMI-1、eDP-1)及支持的分辨率:
xrandr
輸出示例:
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 7680 x 4320
HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm
1920x1080 60.00*+ 50.00 59.94
2560x1440 59.96
3840x2160 30.00 25.00
若需要的分辨率未在xrandr輸出中列出,可使用cvt命令生成。例如,添加3840x2160@60Hz模式:
cvt 3840 2160 60
輸出示例:
# 3840x2160 59.98 Hz (CVT 8.29M9) hsync: 134.18 kHz; pclk: 712.75 MHz
Modeline "3840x2160_60.00" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync
將cvt生成的Modeline復制,使用xrandr --newmode創建模式,再用xrandr --addmode添加到顯示器:
xrandr --newmode "3840x2160_60.00" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync
xrandr --addmode HDMI-1 "3840x2160_60.00"
注:將
HDMI-1替換為你的顯示器名稱(來自xrandr輸出)。
使用xrandr --output命令應用新分辨率:
xrandr --output HDMI-1 --mode "3840x2160_60.00"
若需重啟后保持分辨率不變,需修改Xorg配置文件:
停止圖形界面(如GDM),生成默認配置:
sudo systemctl stop gdm
sudo Xorg -configure
生成的配置文件通常位于/root/xorg.conf.new,將其復制到/etc/X11/xorg.conf:
sudo mv /root/xorg.conf.new /etc/X11/xorg.conf
打開/etc/X11/xorg.conf,在Section "Monitor"中添加Modeline和PreferredMode,在Section "Screen"中指定默認模式:
Section "Monitor"
Identifier "Configured Monitor"
Modeline "3840x2160_60.00" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync
Option "PreferredMode" "3840x2160_60.00"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "3840x2160_60.00" "1920x1080" # 優先使用3840x2160,失敗則回退到1080p
EndSubSection
EndSection
注:
Device部分需根據你的顯卡型號修改(可通過lspci | grep VGA查看)。
sudo reboot
若使用GNOME、KDE等桌面環境,可通過圖形工具快速調整:
xrandr可能無法正常工作。picom(Compton的Wayland分支),但分辨率調整仍依賴系統工具。xorg.conf前建議備份(sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak),避免配置錯誤導致無法進入桌面。