Compton 是一个在 Linux 上常用的轻量级合成器(compositor),通常用于没有自带合成功能的窗口管理器(如 Openbox、i3、AwesomeWM、bspwm 等),用来实现:
Compton 的配置通常是一个文本配置文件,用来定义它的行为,比如:
配置文件一般位于:
~/.config/compton.conf
或旧版本:
~/.compton.conf
# 启用阴影
shadow = true;
shadow-radius = 12;
shadow-opacity = 0.5;
shadow-offset-x = -4;
shadow-offset-y = -4;
# 透明设置
opacity-rule = [
"90:class_g = 'URxvt'",
"80:class_g = 'Firefox'"
];
# 动画
fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
# 性能
vsync = true;
backend = "glx";
shadow = true;
shadow-radius = 10;
shadow-opacity = 0.6;
opacity-rule = [
"85:class_g = 'Alacritty'",
"100:class_g = 'conky'"
];
fading = true;
fade-delta = 5;
backend = "glx";
vsync = true;
shadow-exclude = [
"class_g = 'Panel'",
"name = 'Notification'"
];
compton --config ~/.config/compton.conf &
或在 i3 / Openbox 的 autostart 中加一行。
⚠️ 注意:
Compton 已停止维护,社区分支有:
配置方式几乎完全兼容。
例如:
picom --config ~/.config/picom.conf
✅ 使用 i3 / bspwm / Openbox
✅ 想要透明 & 阴影但不想用完整桌面环境
❌ 已用 GNOME / KDE(自带合成器)
如果你愿意,我可以: