Linux Compton优化图形显示效果
一 基础准备与配置路径
nano ~/.config/compton.conf。修改后可通过重启会话或执行 killall compton && compton & 使配置生效。若需指定自定义路径:compton --config /path/to/compton.conf。在部分桌面环境(如 GNOME/KDE)中可能与内置合成器冲突,必要时先禁用内置合成器再启用 Compton。二 关键参数与推荐设置
90:class_g 'Firefox'、95:name 'Terminal'。若追求性能可关闭 fade = false 减少过渡动画开销。三 性能优化与稳定性
cpulimit -l 50 -p $(pgrep compton)。四 配置示例与自动启动
backend = "glx"
vsync = true
shadow = false
fade = true
unredirect = false
[blur]
method = "gaussian"
size = 8
deviation = 4.0
[opacity-rule]
90:class_g 'Firefox'
95:name 'Terminal'
100:class_g 'Xephyr'
compton --config ~/.config/compton.conf & 加入窗口管理器/会话的启动脚本(如 i3 的 config、Openbox 的 autostart)。方式二(systemd 用户服务):创建文件 ~/.config/systemd/user/compton.service[Unit]
Description=Compton Window Composer
After=xorg.target
[Service]
ExecStart=/usr/bin/compton --config %h/.config/compton.conf --log-level 0
Restart=on-failure
[Install]
WantedBy=default.target
启用命令:systemctl --user daemon-reload && systemctl --user enable --now compton。提示:部分发行版已用 picom 作为 Compton 的继任者,配置项大多兼容,必要时将命令替换为 picom。