在Linux系統中,Compton是一個輕量級的X11窗口合成器,它可以提供硬件加速的窗口渲染和透明度效果。以下是一些優化多顯示器設置的技巧:
在基于Debian的系統上,使用以下命令安裝Compton:
sudo apt-get update
sudo apt-get install compton
在主目錄下創建一個名為 .compton.conf
的文件,并在其中添加配置。例如:
backend "glx";
glx-no-stencil false;
glx-copy-from-front true;
glx-shape true;
glx-fbconfig false;
glx-hardware true;
glx-damage true;
damage true;
opacity-rule [ "class_g \"Desktop\" A", "class_g \"Gnome-terminal\" A", "class_g \"Firefox\" A" ];
shadow-exclude [ "class_g \"Desktop\"", "class_g \"Gnome-terminal\"", "class_g \"Firefox\"" ];
在配置文件中添加 xrandr
命令的輸出,以便Compton知道如何處理多個顯示器。例如:
xrandr-output HDMI-1 eDP-1;
為了讓Compton隨系統啟動自動運行,請創建Systemd服務文件 /etc/systemd/system/compton.service
,并添加以下內容:
[Unit]
Description=Compton Window Composer
After=xorg.service
[Service]
ExecStart=/usr/bin/compton --config /etc/compton.conf
RestartOnFailure=yes
[Install]
WantedBy=multi-user.target
保存后,運行以下命令啟用并啟動Compton服務:
sudo systemctl daemon-reload
sudo systemctl enable compton
sudo systemctl start compton
backend
設置為 glx
或 wayland
(而非 xrender
),通常能提升性能。vsync
設置為 true
或 false
,找到最佳平衡點。