在 Ubuntu(或其他 Linux 桌面)里,Compton 是一个轻量级的合成器(现在很多发行版改用它的分支 picom)。调整“透明度”一般有两种情况:
编辑 Compton 配置文件(通常是 ~/.config/compton.conf 或 ~/.compton.conf):
opacity-rule = [
"90:class_g = '.*'"
];
意思是:所有窗口 90% 不透明度(10% 透明)。
常见写法:
100 = 完全不透明80 = 20% 透明例如:
opacity-rule = [
"85:class_g = '.*'"
];
inactive-opacity = 0.8;
active-opacity = 1.0;
效果:
先查窗口类名:
xprop | grep WM_CLASS
然后点窗口。
例如让终端透明:
opacity-rule = [
"80:class_g = 'Alacritty'",
"90:class_g = 'Firefox'"
];
backend = "glx";
vsync = true;
killall compton
compton --config ~/.config/compton.conf &
如果是 picom:
killall picom
picom --config ~/.config/compton.conf &
Ubuntu 20.04+ 多用 picom,不是 compton
命令可能是 picom 而不是 compton
GNOME 桌面默认不支持 Compton
推荐:
Wayland 不支持 Compton
必须切到 X11
如果你愿意,可以告诉我:
我可以直接帮你写一份 可用配置。