以下是在CentOS上快速配置Compton的方法:
如果使用的是CentOS 7及以下系统,可先安装EPEL仓库,再使用yum安装Compton:
sudo yum install epel-release -y
sudo yum install compton -y
CentOS 8及以上系统可直接用dnf安装:
sudo dnf install compton -y
创建或编辑配置文件~/.config/compton.conf
,添加以下基本配置:
backend = "glx"
shadow = true
opacity = 0.8
ignore_root = true
手动启动Compton可使用命令compton -c ~/.config/compton.conf
。
创建systemd服务文件/etc/systemd/system/compton.service
,内容如下:
[Unit]
Description=Compton Compositor
After=graphical.target
[Service]
ExecStart=/usr/bin/compton -c ~/.config/compton.conf
Restart=on-failure
[Install]
WantedBy=graphical.target
然后执行以下命令启用并启动服务:
sudo systemctl enable compton
sudo systemctl start compton