安裝Compton
sudo apt update && sudo apt install compton
配置文件路徑
默認配置文件位于 ~/.config/compton.conf
,可通過文本編輯器(如nano
)修改:
nano ~/.config/compton.conf
glx
或wayland
后端(需顯卡支持OpenGL),提升渲染性能:backend = glx # 或 wayland
shadow = false
)和透明度(opacity = false
)可減少資源占用:shadow = false
opacity = false
cpulimit
限制CPU使用率(例如50%):cpulimit -l 50 -p $(pgrep compton)
opacity-rule
為特定窗口設置透明度(如終端90%、瀏覽器80%):opacity-rule = [
"90:class_g 'Terminal'",
"80:class_g 'Firefox'"
]
xcompmgr
支持):blur-background = true
blur-kern = "3x3box" # 模糊算法,可選"gaussian"等
screen-edge-blur = true
systemd
服務文件(如/etc/systemd/system/compton.service
):[Unit]
Description=Compton Compositor
After=display-manager.service
[Service]
ExecStart=/usr/bin/compton --config ~/.config/compton.conf
Restart=always
啟用服務:sudo systemctl enable compton
sudo systemctl start compton
~/.cache/compton.log
)排查問題:cat ~/.cache/compton.log
cp ~/.config/compton.conf ~/.config/compton.conf.bak
)。以上技巧可根據硬件配置和桌面環境調整,優先保證性能穩定后再優化視覺效果[1,2,3,4,5,6,7,8,9,10,11]。