以下是CentOS下Compton的配置教程:
确保系统更新到最新,然后安装依赖包:
sudo yum update -y
sudo yum groupinstall -y "Development Tools"
sudo yum install -y cmake git libX11-devel libXext-devel libXrender-devel libXi-devel libXrandr-devel libXinerama-devel libXcursor-devel libXcomposite-devel
从GitHub克隆Compton源码并编译安装:
git clone https://github.com/compton/compton.git
cd compton
mkdir build && cd build
cmake ..
make
sudo make install
Compton默认配置文件通常位于~/.config/compton.conf
,若不存在则手动创建。用文本编辑器打开配置文件,例如:
nano ~/.config/compton.conf
可设置如backend = "glx"
等选项,常见配置选项含义可参考相关文档。
可手动启动:
compton --config ~/.config/compton.conf
若要开机自启动,创建systemd服务文件/etc/systemd/system/compton.service
,内容如下:
[Unit]
Description=Compton Compositor
After=graphical.target
[Service]
ExecStart=/usr/local/bin/compton --config ~/.config/compton.conf
Restart=on-failure
[Install]
WantedBy=graphical.target
然后启用并启动服务:
sudo systemctl enable compton
sudo systemctl start compton