你提到的 Compton 是 Linux 下常用的 X11 合成器(compositor),现在多数发行版已改用它的分支 picom,但配置方式基本一致。下面按常见需求说明。
默认配置文件:
~/.config/compton.conf
如果没有,可以手动创建:
mkdir -p ~/.config
touch ~/.config/compton.conf
# 开启阴影
shadow = true;
shadow-radius = 12;
shadow-opacity = 0.5;
shadow-offset-x = -2;
shadow-offset-y = -2;
# 开启透明
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
# 淡入淡出
fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
# 后台运行
daemon = true;
# 避免屏幕撕裂
vsync = true;
# 后端
backend = "glx";
shadow = false;
opacity-rule = [
"100:class_g = 'Steam'",
"100:class_g = 'firefox'"
];
vsync = true;
backend = "glx";
如果是 NVIDIA:
backend = "xrender";
在 ~/.xinitrc 或桌面环境自启里加:
compton &
或(picom):
picom &
⚠️ 注意:
sudo apt install picom # Debian/Ubuntu
sudo pacman -S picom # Arch
配置文件:
~/.config/picom.conf
查看是否运行:
ps aux | grep compton
手动运行看错误:
compton --config ~/.config/compton.conf
我可以直接给你一份可用配置。