Ubuntu 下配置 Compton 的关键注意事项
一 会话与桌面环境
二 安装与配置路径
sudo apt update && sudo apt install compton。compton --config ~/.config/compton.conf &;或加入会话的“启动应用程序”。killall compton 再启动以应用;不建议使用 sudo systemctl restart compton(Compton 通常以用户会话运行)。三 关键配置项与性能
glx 通常性能更好,但在部分驱动/硬件上更易出现兼容性问题。vsync 平衡撕裂与输入延迟;若出现卡顿或画面异常,可切换 true/false 测试。shadow 控制阴影;bg_blur/screen_edge_blur 提升观感但会增加 GPU/CPU 负担,低配或老旧显卡可关闭。opacity-rule 为不同窗口设置透明度,例如opacity-rule = ["90:class_g 'Firefox'", "90:name 'Terminal'"];focus-exclude 保持不透明,避免交互问题。ignore_root = true,防止某些桌面/壁纸工具出现透明异常。四 显卡驱动与常见问题排查
--log-path 输出日志,或查看 ~/.cache/compton/ 下的日志文件,依据报错调整配置。五 自动启动与系统服务
compton --config ~/.config/compton.conf & 加入“启动应用程序”,登录即自动运行。[Unit]
Description=Compton Window Composer
After=graphical-session.target
[Service]
ExecStart=/usr/bin/compton --config %h/.config/compton.conf
Restart=on-failure
[Install]
WantedBy=graphical-session.target
systemctl --user daemon-reload && systemctl --user enable --now compton.service