在 Linux 中,compton(现在多被 fork 为 picom)本身没有“保存按钮”,它的配置是通过配置文件来持久化的。你修改配置后,只要写进配置文件,下次启动就会自动加载。
下面按常见情况给你说明。
~/.config/compton.conf
或(新版 picom):
~/.config/picom.conf
如果文件不存在,可以自己创建:
mkdir -p ~/.config
touch ~/.config/compton.conf
/etc/xdg/compton.conf
对所有用户生效,但容易被系统更新覆盖。
# ~/.config/compton.conf
backend = "glx";
shadow = true;
shadow-radius = 12;
shadow-opacity = 0.5;
fade = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
保存后:
compton --config ~/.config/compton.conf
或直接重启:
killall compton
compton &
否则你“保存了配置”,但下次开机没启动 = 像没保存。
.xinitrc# ~/.xinitrc
compton --config ~/.config/compton.conf &
compton --config ~/.config/compton.conf
或(picom):
picom --config ~/.config/picom.conf
| 项目 | compton | picom |
|---|---|---|
| 配置文件 | compton.conf | picom.conf |
| 命令 | compton | picom |
| 状态 | 已停止维护 | 活跃维护 |
建议新系统直接用 picom
❌ 只在命令行加参数,不改配置文件
→ 重启后失效
❌ 改了配置但 compton 没重启
→ 配置不生效
❌ 用 root 改 /etc/xdg,但用户目录有配置
→ 用户配置优先级更高
ps aux | grep compton
看到 --config 就说明用配置文件启动了。
如果你愿意,可以把你的 桌面环境 / 发行版 / compton 或 picom 版本 发给我,我可以直接帮你写一份“开箱即用”的配置。