Debian 下使用 Compton 的实用配置示例
一 安装与准备
二 配置文件示例
# ~/.config/compton.conf
backend = glx
vsync = true
glx-sync = true
glx-no-stencil = true
glx-copy-from-front = false
glx-fbo = true
glx-damage = true
glx-hw-accel = true
# 阴影
shadow = true
shadow-radius = 12
shadow-offset-x = 2
shadow-offset-y = 2
shadow-opacity = 0.45
shadow-exclude = [
"class_g = 'GtkWindow'",
"class_g = 'GtkDialog'",
"class_g = 'MatePanel'",
"class_g = 'Xfce4-panel'",
"class_g = 'Polybar'",
"_NET_WM_WINDOW_TYPE@:a = 'dock'",
"_NET_WM_WINDOW_TYPE@:a = 'desktop'"
]
# 淡入淡出
fade = true
fade-delta = 10
# 不重定向(提升某些全屏游戏/视频性能)
unredirect = pointer
# 背景模糊(需后端支持,glx 下通常可用)
blur-background = true
blur-background-fixed = false
blur-kern = "3x3box"
# 窗口透明度规则(语法:透明度:条件)
[opacity-rule]
90:class_g = 'Firefox'
95:class_g = 'Alacritty'
95:class_g = 'xterm'
100:class_g = 'Polybar'
100:class_g = 'Conky'
# 忽略根窗口透明,避免桌面背景异常
ignore-root = true
三 启动与自启动
[Unit]
Description=Compton Compositor
After=display-manager.service
[Service]
ExecStart=/usr/bin/compton --config /home/你的用户名/.config/compton.conf
Restart=always
User=你的用户名
[Install]
WantedBy=multi-user.target
四 常见问题与优化