在 CentOS 上让 Compton 与 KDE Plasma 协同工作
一 适配性与前提
二 安装与准备
sudo yum install -y comptonsudo dnf install -y compton~/.config/compton.conf。可先创建空文件再编辑:touch ~/.config/compton.conf。三 配置与集成步骤
~/.config/autostart/compton.desktop[Desktop Entry]
Type=Application
Exec=/usr/bin/compton --config ~/.config/compton.conf
Hidden=false
X-GNOME-Autostart-enabled=true
Name=Compton
~/.config/systemd/user/compton.service[Unit]
Description=Compton Window Compositor
After=graphical-session.target
[Service]
ExecStart=/usr/bin/compton --config %h/.config/compton.conf
Restart=on-failure
[Install]
WantedBy=graphical-session.target
systemctl --user daemon-reload && systemctl --user enable --now compton.serviceAfter=display-manager.service 并在图形会话中启动,避免与用户会话冲突。四 推荐配置与性能优化
~/.config/compton.conf):backend = "glx"
vsync = "opengl-swc" # 或 true;根据驱动与体验二选一
frame-rate = 60
shadow = true
shadow-radius = 12
shadow-offset-x = -15
shadow-offset-y = -15
shadow-opacity = 0.75
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g = 'Cairo-clock'",
"class_g = 'Plasma'",
"class_g = 'KWin'"
]
fading = true
fade-delta = 5
fade-in-step = 0.03
fade-out-step = 0.03
glx-no-stencil = true
glx-copy-from-front = true
frame-dropping = true
vsync 模式或回退到 xrender(性能较低)。shadow = false、opacity = 1.0,可显著降低开销。xrandr 输出正确;Compton 通常无需额外参数即可适配,必要时再微调。五 常见问题与排错
~/.config/autostart/compton.desktop 是否存在且 Exec 路径正确;若用 systemd,确认使用 –user 服务并在图形会话中启用。compton --config ~/.config/compton.conf -v 查看日志;按需调整 frame-rate、shadow-exclude、vsync 与 backend。