安装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]。