Compton配置Ubuntu桌面环境指南
一 安装与准备
sudo apt update && sudo apt install compton~/.config/compton.conf/etc/xdg/compton.confcompton --version二 配置要点与示例
backend:渲染后端,常用 “glx”(OpenGL)或 “xrender”(兼容性更好)。vsync:垂直同步,设为 true/false 以适配你的显示器与显卡。shadow:窗口阴影,设为 true/false。fade:窗口淡入淡出动画,设为 true/false。shadow-exclude:按窗口类/标题排除阴影,减少特定程序(如视频播放器)阴影干扰。opacity-rule:按窗口类/标题设置透明度(0.0–1.0)。~/.config/compton.conf):# 全局
backend = "glx"
vsync = true
shadow = true
fade = true
shadow-exclude = [
"class_g = 'Firefox'",
"class_g = 'Chromium'",
"name = 'VLC'"
]
# 阴影细节
shadow-radius = 12
shadow-offset-x = -2
shadow-offset-y = 2
shadow-opacity = 0.25
# 透明度规则
[opacity-rule]
90:class_g 'Firefox'
95:class_g 'Terminal'
100:class_g 'Xephyr'
backend 或在 vsync 间调整;不需要阴影时关闭 shadow 可提升性能。三 启动与自启动
compton --config ~/.config/compton.conf -fcompton --config ~/.config/compton.conf -bcompton -b 加入 ~/.xprofile 或 ~/.xinitrc。~/.config/autostart/compton.desktop),内容示例:[Desktop Entry]
Type=Application
Exec=compton -b --config ~/.config/compton.conf
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Compton
四 调试与常见问题
compton --log-file=/tmp/compton.logkillall compton && compton --config ~/.config/compton.conf -b