在 Ubuntu 上配置 Compton(现已多被 picom 取代,但配置方式基本一致)通常用于实现窗口透明、阴影、模糊等合成效果。下面从安装 → 配置 → 启动一步步说明。
sudo apt update
sudo apt install compton
sudo apt install picom
以下示例以
picom为例,如果你用compton,只需把命令中的picom换成compton。
默认配置文件位置:
~/.config/picom/picom.conf
如果没有就创建:
mkdir -p ~/.config/picom
touch ~/.config/picom/picom.conf
编辑配置文件:
nano ~/.config/picom/picom.conf
backend = "glx";
vsync = true;
shadow = true;
shadow-radius = 12;
shadow-opacity = 0.5;
shadow-offset-x = -2;
shadow-offset-y = -2;
fade = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
inactive-opacity = 0.9;
active-opacity = 1.0;
blur:
{
method = "gaussian";
size = 10;
deviation = 5.0;
}
picom --config ~/.config/picom/picom.conf &
或
compton --config ~/.config/picom/picom.conf &
mkdir -p ~/.config/autostart
创建文件:
nano ~/.config/autostart/picom.desktop
内容:
[Desktop Entry]
Type=Application
Name=Picom
Exec=picom --config ~/.config/picom/picom.conf
X-GNOME-Autostart-enabled=true
backend = "xrender";
picom --replacebackend = "glx"picom --config ~/.config/picom/picom.conf --log-level DEBUG
如果你用的是 Ubuntu 版本 + 桌面环境(GNOME / KDE / i3 / XFCE),可以告诉我,我可以给你更精确的配置方案。