在 CentOS 上优化 Compton 图形性能
一 基础准备与安装
二 关键配置优化
三 示例配置文件
# ~/.config/compton.conf
backend = "glx"
vsync = true
shadow = false
# opacity/alpha 相关:关闭全局透明,按需用 opacity-rule
opacity = false
alpha-mode = "none"
# 帧率与重绘
frame-rate = 60
# refresh-rate = 60 # 可按显示器实际刷新率设置
# 精细控制:仅为特定应用启用透明
opacity-rule = [
"90:class_g='Firefox'",
"90:class_g='Alacritty'"
]
# 可选:对已知重绘频繁的应用关闭合成(减少开销)
paint-on-overlay = true
unredir-if-possible = true
四 启动与自启
[Unit]
Description=Compton Window Composer
After=graphical-session.target
[Service]
ExecStart=/usr/bin/compton --config %h/.config/compton.conf
Restart=always
[Install]
WantedBy=default.target
[Unit]
Description=Compton Window Composer
After=display-manager.service
[Service]
ExecStart=/usr/bin/compton --config /etc/xdg/compton.conf
Restart=always
[Install]
WantedBy=multi-user.target
五 验证与排障