在 Ubuntu 上使用 Compton(或已演化的 picom) 出现黑屏,通常不是“配置写错一个字”那么简单,而是和 显示协议、 compositor 冲突、显卡驱动 有关。下面按最常见原因 → 解决方法说明。
如果你用的是:
而又手动启动了 compton/picom,就会:
✅ 解决方法:
# 关闭系统自带合成器
gnome-shell 的合成(一般不建议在 GNOME 用 compton)然后再启动 compton。
Ubuntu 22.04+ 默认可能用 Wayland
而 compton / picom 只支持 X11
✅ 检查:
echo $XDG_SESSION_TYPE
如果是 wayland → 必黑屏
✅ 解决:
比如:
backend = "glx";
在部分显卡 / 驱动下会直接黑屏
✅ 解决(先试这个):
backend = "xrender";
或 picom 新版:
backend = "xrender";
NVIDIA 闭源驱动 + glx backend 常黑屏
✅ 解决:
xrenderglx-no-stencil = true;
glx-no-rebind-pixmap = true;
很多人直接:
compton &
但没杀掉旧进程
✅ 正确方式:
killall compton
compton --config ~/.config/compton.conf &
backend = "xrender";
vsync = true;
shadow = false;
fade = false;
⚠️ compton 已停止维护 现在应该用:
sudo apt install picom
picom --config ~/.config/picom.conf
如果你愿意,可以告诉我:
我可以直接给你一份不会黑屏的配置文件。