在 Ubuntu 上配置 Compton(现在多称为 picom,Compton 的活跃分支),通常用于为无原生混成的窗口管理器(如 i3、Openbox、Awesome 等)提供窗口透明、阴影、模糊等特效。
下面从 安装 → 基础配置 → 常用参数 → 开机启动 一步步说明。
sudo apt update
sudo apt install compton
或使用更活跃的 fork:
sudo apt install picom
注意:Ubuntu 20.04+ 以后,
picom通常是 Compton 的替代品
Compton 默认读取:
~/.config/compton.conf
如果不存在,可以手动创建:
mkdir -p ~/.config
touch ~/.config/compton.conf
下面是一个 通用且稳定 的 compton.conf 示例:
# 后台运行
daemon = true;
# 阴影
shadow = true;
shadow-radius = 8;
shadow-opacity = 0.5;
shadow-offset-x = -2;
shadow-offset-y = -2;
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g = 'Dmenu'"
];
# 透明
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
# 淡入淡出
fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
# 垂直同步
vsync = true;
# 后端(性能更好)
backend = "glx";
# 排除全屏应用(看视频更流畅)
unredir-if-possible = true;
compton --config ~/.config/compton.conf
或(picom):
picom --config ~/.config/compton.conf
在 ~/.config/i3/config 中添加:
exec --no-startup-id compton --config ~/.config/compton.conf
在 ~/.config/openbox/autostart 中:
compton --config ~/.config/compton.conf &
systemctl --user enable compton
尝试:
backend = "xrender";
vsync = false;
GNOME 已有 Mutter,不需要 Compton
✅ i3 / bspwm / dwm / openbox
❌ GNOME / KDE(自带混成)
如果你告诉我:
我可以给你一份 专属配置。