在 Linux 下把 Compton(或其继任者 picom) 的配置“移植”,通常分几种情况来理解。下面按常见场景给你讲清楚。
Compton 默认读取配置文件路径一般是:
~/.config/compton.conf/etc/compton.conf~/.compton.conf注意:很多发行版已用 picom 替代 compton
配置文件通常是:~/.config/picom.conf
最简单的情况:换系统或重装
cp ~/.config/compton.conf ~/compton.conf.bak
# 或
cp ~/.config/picom.conf ~/picom.conf.bak
cp ~/compton.conf.bak ~/.config/compton.conf
在源机器:
scp ~/.config/compton.conf user@newhost:~/.config/
在新机器上:
compton --config ~/.config/compton.conf &
或 picom:
picom --config ~/.config/picom.conf &
Compton 配置基本可通用,但需要注意:
backend(xrender / glx)vsyncunredir-if-possible例如 NVIDIA 机器:
backend = "glx";
vsync = true;
Intel / AMD:
backend = "xrender";
Compton 已停止维护,建议迁移到 picom
compton.conf 大部分可用picom.conf(语法更接近 JSON)cp ~/.config/compton.conf ~/.config/picom.conf
# 老写法
shadow = true;
# 新写法
shadow = true;
若启动报错,可先试运行:
picom --config ~/.config/picom.conf --diagnostics
配置迁过去后,还要确保开机自启
在配置里加:
exec --no-startup-id compton
或
picom &
~/.config/systemd/user/compton.service
内容示例:
[Unit]
Description=Compton compositor
[Service]
ExecStart=/usr/bin/picom
[Install]
WantedBy=default.target
启用:
systemctl --user enable compton
❌ 配置文件路径错
❌ 没装 xorg-xprop / xorg-xwininfo
❌ NVIDIA 没开 glx
❌ 多显卡环境 backend 不对
如果你愿意,可以告诉我:
我可以直接给你一份可移植的配置模板。