在 Linux 下,compton(现在多被分支 picom 取代)的“配置备份”其实就是备份它的配置文件和相关启动项。下面按常见情况说明。
compton / picom 的配置文件通常在这里之一:
~/.config/compton.conf
~/.config/picom.conf
~/.compton.conf
/etc/compton.conf
/etc/picom.conf
cp ~/.config/compton.conf ~/.config/compton.conf.bak
或整体备份配置目录:
cp -r ~/.config/compton ~/.config/compton.bak
如果是 picom:
cp ~/.config/picom.conf ~/.config/picom.conf.bak
compton 可能通过以下方式启动,建议一并备份:
~/.xinitrc~/.xprofile~/.config/autostart/compton.desktop例如:
cat ~/.xinitrc | grep compton
备份:
cp ~/.xinitrc ~/.xinitrc.bak
mkdir -p ~/backup/compton
cp ~/.config/compton.conf ~/backup/compton/ 2>/dev/null
cp ~/.config/picom.conf ~/backup/compton/ 2>/dev/null
cp ~/.xinitrc ~/backup/compton/ 2>/dev/null
cp ~/.xprofile ~/backup/compton/ 2>/dev/null
echo "compton 配置已备份到 ~/backup/compton"
cp ~/backup/compton/compton.conf ~/.config/compton.conf
然后重启 compton / 重新登录即可。
现在很多发行版已用 picom,命令几乎一样:
picom --config ~/.config/picom.conf
备份:
cp ~/.config/picom.conf ~/.config/picom.conf.bak
如果你愿意,可以告诉我:
我可以给你更精确的备份方案。