Compton配置于CentOS的完整步驟
sudo yum update -y
sudo yum install epel-release -y
sudo yum install compton -y
yum
替換為dnf
:sudo dnf install compton -y
)sudo yum groupinstall "Development Tools" -y
sudo yum install cmake git mesa-libGL-devel libX11-devel libXext-devel libXrandr-devel -y
git clone https://github.com/compton/compton.git
cd compton
mkdir build && cd build
cmake ..
make
sudo make install
(默認安裝到/usr/local/bin
)sudo mkdir -p /etc/compton
sudo nano /etc/compton.conf
mkdir -p ~/.config/compton
nano ~/.config/compton.conf
# 后端選擇(glx適用于OpenGL加速,xrender適用于無OpenGL環境)
backend = "glx";
# 陰影設置(排除Firefox等不需要陰影的應用)
shadow = true;
shadow-exclude = [
"class_g = 'Firefox'",
"class_g = 'Chromium'",
"name = 'Notification'",
"name = 'Plank'"
];
shadow-opacity = 0.7;
# 透明度設置(桌面/窗口透明度)
opacity = 0.9;
inactive-opacity = 0.8;
# 性能優化(禁用模板緩沖區提升幀率)
glx-no-stencil = true;
glx-copy-from-front = true;
# 禁用漸變效果(減少資源占用)
gradient = false;
注:可根據需求調整參數,如
backend
(glx/xrender)、shadow
(開啟/關閉陰影)、opacity
(透明度)等。
compton --config /etc/compton.conf
compton --config ~/.config/compton.conf
sudo nano /etc/systemd/system/compton.service
ExecStart
):[Unit]
Description=Compton Compositor
After=graphical.target
[Service]
ExecStart=/usr/bin/compton --config /etc/compton.conf
Restart=on-failure
User=root
[Install]
WantedBy=multi-user.target
sudo systemctl enable compton.service
sudo systemctl start compton.service
systemctl status compton.service
(若顯示“active (running)”則表示成功)journalctl -u compton.service -b