Compton 透明度设置指南
一 配置思路与关键点
二 配置文件示例
# ~/.config/compton.conf
backend = "xrender"
vsync = true
shadow = true
# 背景透明度(0.0–1.0,1.0 为不透明)
background-opacity = 0.9
# 淡入淡出步长(数值越小越平滑,但可能更耗资源)
fade-in-step = 0.03
fade-out-step = 0.03
# 按窗口设置透明度
opacity-rule = [
"90:class_g 'Firefox'",
"90:name 'Terminal'",
"95:class_g 'alacritty' && !_NET_WM_STATE@:32a", # 未全屏时 95%
"0:_NET_WM_STATE@:32a * '_NET_WM_STATE_HIDDEN'" # 隐藏窗口完全透明
]
# 排除特定窗口(如 dmenu 覆盖层)
focus-exclude = "x 0 && y 0 && override_redirect true"
# 忽略根窗口透明度
ignore_root = true
三 应用与热重载
killall compton
compton --config ~/.config/compton.conf &
systemctl --user restart compton
compton -b -r 0.5 -i 0.8
其中 -b 后台运行,-r 0.5 设置全局透明度为 50%,-i 0.8 设置聚焦窗口透明度为 80%(示例值,具体以你的 Compton 版本参数为准)。四 常见问题与排查