在 Debian 上配置 Compton(现在多数发行版已更名为 Picom,但旧包名仍为 compton)通常用于为无内置合成器的窗口管理器(如 i3、Openbox、Awesome 等)提供透明、阴影、模糊等特效。
下面以 Debian + i3 为例说明配置步骤。
sudo apt update
sudo apt install compton
如果你使用较新 Debian(12+),也可以安装 picom:
sudo apt install picom配置方式基本一致。
mkdir -p ~/.config/compton
compton --config ~/.config/compton/compton.conf --help >/dev/null 2>&1 || true
手动创建配置文件:
nano ~/.config/compton/compton.conf
下面是一个常用、稳定的配置:
# 后台运行
daemon = true
# 日志
log-level = "warn"
# 阴影
shadow = true
shadow-radius = 12
shadow-offset-x = -2
shadow-offset-y = -2
shadow-opacity = 0.4
shadow-exclude = [
"class_g = 'i3-frame'"
]
# 透明度
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
]
# 淡入淡出
fading = true
fade-in-step = 0.03
fade-out-step = 0.03
# 合成方式
backend = "glx"
glx-no-stencil = true
vsync = "opengl-swc"
# 排除某些窗口(如全屏游戏)
unredir-if-possible = true
compton --config ~/.config/compton/compton.conf
如无报错,说明配置正常。
编辑 ~/.config/i3/config:
exec --no-startup-id compton --config ~/.config/compton/compton.conf
重启 i3:
Mod + Shift + R
inactive-opacity = 0.9
active-opacity = 1.0
backend = "glx"
blur-method = "gaussian"
blur-strength = 10
unredir-if-possible = true
backend = "xrender"compton --config ~/.config/compton/compton.conf --log-level trace
如果你用的是 GNOME / KDE,通常不需要 Compton;
如果你用的是 i3 / bspwm / dwm / Openbox,Compton/Picom 是标准方案。
告诉我你用的 窗口管理器 和 Debian 版本,我可以给你更精确的配置。