在 Ubuntu 上 Compton(现在更多被 picom 取代)通常用于实现窗口透明、阴影、淡入淡出等合成效果。下面从安装 → 配置 → 开机自启给你一套完整设置方法。
Compton 已停止维护,Ubuntu 官方源里通常是 picom:
sudo apt update
sudo apt install picom
如果你确实要用旧版 compton:
sudo apt install compton
mkdir -p ~/.config/picom
nano ~/.config/picom/picom.conf
backend = "glx";
opacity-rule = [
"90:class_g = 'URxvt'",
"80:class_g = 'Firefox'"
];
shadow = true;
shadow-radius = 12;
shadow-offset-x = -2;
shadow-offset-y = -2;
shadow-opacity = 0.5;
fade = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
vsync = true;
inactive-opacity = 0.9;
active-opacity = 1.0;
opacity-rule = [
"100:class_g = 'Conky'",
"100:class_g = 'Polybar'"
];
picom --config ~/.config/picom/picom.conf
如果没问题,可以后台运行:
picom &
Picompicom --config ~/.config/picom/picom.conf
nano ~/.config/systemd/user/picom.service
[Unit]
Description=Picom Compositor
[Service]
ExecStart=/usr/bin/picom --config %h/.config/picom/picom.conf
Restart=on-failure
[Install]
WantedBy=default.target
systemctl --user enable picom
systemctl --user start picom
vsyncbackend = "xrender";
ps aux | grep picom
如果你告诉我:
我可以帮你写一份专属 picom 配置。