debian

Debian系统中Compton配置的最佳实践

小樊
55
2025-10-06 08:00:41
栏目: 智能运维

1. 安装Compton
在Debian系统上,首先通过以下命令更新软件包列表并安装Compton:

sudo apt update && sudo apt upgrade -y
sudo apt install compton x11-xserver-utils wmctrl -y

x11-xserver-utilswmctrl是Compton运行所需的依赖项,确保系统兼容性。

2. 配置Compton
Compton的默认配置文件位于~/.config/compton.conf(若不存在则手动创建)。使用文本编辑器(如nano)打开配置文件,根据需求调整以下核心参数:

3. 启动Compton
配置完成后,通过命令行启动Compton并指定配置文件:

compton --config ~/.config/compton.conf &

若需验证Compton是否运行,可使用ps aux | grep compton查看进程。

4. 设置开机自启动
为避免每次登录手动启动Compton,可创建systemd服务文件:

sudo nano /etc/systemd/system/compton.service

添加以下内容(替换你的用户名为实际用户名):

[Unit]
Description=Compton Compositor
After=display-manager.service

[Service]
ExecStart=/usr/bin/compton --config ~/.config/compton.conf
Restart=always
User=你的用户名

[Install]
WantedBy=multi-user.target

保存后,启用并启动服务:

sudo systemctl enable compton
sudo systemctl start compton

5. 性能优化技巧

6. 测试与验证
启动Compton后,通过以下方式验证配置效果:

0
看了该问题的人还看了