在 Ubuntu 上使用 Compton(现在更多叫 picom)实现窗口/桌面透明,一般按下面步骤来。
Ubuntu 新版推荐用 picom(Compton 的 Fork):
sudo apt update
sudo apt install picom
如果你坚持用老版 compton:
sudo apt install compton
mkdir -p ~/.config/picom
nano ~/.config/picom/picom.conf
opacity-rule = [
"0.85"
];
这样所有窗口都是 85% 不透明。
inactive-opacity = 0.8;
active-opacity = 1.0;
opacity-rule = [
"0.8:class_g = 'Alacritty'",
"0.8:class_g = 'GNOME-terminal'"
];
backend = "glx";
并确保窗口管理器支持 compositing。
picom --config ~/.config/picom/picom.conf &
gnome-session-properties
添加:
picom --config ~/.config/picom/picom.conf
必须是 X11,不是 Wayland
echo $XDG_SESSION_TYPE
如果是 wayland,Compton 不生效。
不要用 Ubuntu 默认 GNOME + Wayland 建议:
透明终端 vs 窗口透明
opacity-rule = [
"0.9:class_g = 'Alacritty'"
];
如果你告诉我:
我可以直接给你一套可用配置。