Linux Compton 常见问题解答
一 安装与启动
sudo apt-get install compton;在 Arch 执行 sudo pacman -S compton;在 Fedora/RHEL 执行 sudo dnf install compton。ps -e | grep compton;临时启动可用 compton &;如需自启,可创建 systemd 服务单元(示例见下文)。二 配置文件与关键选项
backend:渲染后端,常用 “glx”(性能更好)或 “xrender”(兼容性更好)。vsync:垂直同步,设为 true/false。shadow:窗口阴影,设为 true/false。active-opacity / inactive-opacity / alpha-step 控制。shadow = true; shadow-radius = 5; shadow-offset-x = 1; shadow-offset-y = 1; shadow-opacity = 0.3;active-opacity = 1; inactive-opacity = 0.93; alpha-step = 0.01;backend = "glx"; vsync = true;三 启动失败与配置错误排查
ps -e | grep compton;必要时 killall compton 后重启。grep -i compton /var/log/syslog 或 grep -i compton /var/log/Xorg.0.log。四 性能优化与常见问题处理
shadow = false、blur-background = false。vsync(开/关)与刷新率设置,减少卡顿与撕裂。cpulimit -l 50 -p <PID> 限制占用。backend,或关闭模糊/阴影测试。detect-transient = true、detect-client-leader = true 提升识别与重定向效果。五 附 常用命令与最小可用配置
sudo apt-get install compton / sudo pacman -S compton / sudo dnf install comptoncompton &;killall compton && compton &[Unit]
Description=Compton Window Composer
After=xorg.service
[Service]
ExecStart=/usr/bin/compton --config /etc/compton.conf
Restart=on-failure
[Install]
WantedBy=multi-user.target
启用:sudo systemctl daemon-reload && sudo systemctl enable --now comptonbackend = "glx"
vsync = true
shadow = false
fading = false
inactive-opacity = 0.93
active-opacity = 1
alpha-step = 0.01
unredir-if-possible = true
detect-transient = true
detect-client-leader = true
保存后执行 killall compton && compton & 生效。