Compton在CentOS上的調試與配置指南
sudo yum update -y # CentOS 7
sudo dnf update -y # CentOS 8及以上
sudo yum install epel-release
添加)。sudo yum install compton -y # CentOS 7
sudo dnf install compton -y # CentOS 8及以上
若包管理器中無Compton,可從源碼編譯安裝(參考Compton GitHub文檔)。~/.config/compton.conf
(用戶級)或/etc/compton.conf
(系統級)。若文件不存在,手動創建即可。backend = "glx";
(推薦,硬件加速,適用于大多數桌面環境);若遇兼容性問題,可改用xrender
。shadow = true;
(啟用陰影);shadow-exclude = ["name = 'Notification'", "class_g = 'Conky'"];
(排除通知欄、Conky等窗口的陰影)。inactive-opacity = 0.8;
(非活動窗口透明度0.8);active-opacity = 1.0;
(活動窗口完全不透明);opacity-rule = ["90:class_g = 'Alacritty'", "80:class_g = 'Thunar'"];
(為特定應用設置透明度)。vsync = true;
(開啟垂直同步,避免畫面撕裂)。blur-background = true;
(啟用背景模糊);blur-method = "kawase";
(模糊算法,可選kawase
/gaussian
);blur-strength = 5;
(模糊強度,數值越大越模糊)。compton
(終端中執行,顯示實時日志)。compton -b
(-b
表示后臺模式)。/etc/systemd/system/compton.service
,內容如下:[Unit]
Description=Compton Window Composer
After=display-manager.service # 確保在顯示管理器啟動后運行
[Service]
ExecStart=/usr/bin/compton -c /etc/compton.conf # 指定配置文件路徑
Restart=always # 崩潰后自動重啟
[Install]
WantedBy=multi-user.target # 多用戶模式下啟動
sudo systemctl daemon-reload # 重新加載Systemd配置
sudo systemctl enable compton # 設置開機自啟動
sudo systemctl start compton # 立即啟動服務
```。
--verbose
參數輸出詳細日志,幫助定位問題。compton --verbose 2> /var/log/compton.log # 將日志重定向到文件
cat /var/log/compton.log # 查看日志內容
ps -e | grep compton # 若無輸出,說明未運行
sudo systemctl restart compton # 重啟服務
vsync = true;
已開啟,或嘗試更換后端(如backend = "glx";
)。shadow-exclude
規則是否覆蓋了目標窗口(如通知欄、桌面圖標)。blur-background = false;
)或降低模糊強度(blur-strength = 3;
)。blur-strength
、減少透明度規則數量)。cp ~/.config/compton.conf ~/.config/compton.conf.bak
),避免配置錯誤導致無法啟動。