Debian 下 Compton 设置技巧
一 安装与快速上手
sudo apt update && sudo apt install compton。安装完成后,配置文件通常位于 ~/.config/compton.conf,如不存在可手动创建。使用 nano ~/.config/compton.conf 或 vim ~/.config/compton.conf 编辑。启动/重启 Compton 可用:killall compton && compton &;如需常驻,可将其加入会话自启(如 i3 的 exec --no-startup-id compton)。以上步骤适用于 Openbox、i3 等窗口管理器。二 核心配置与示例
opacity-rule = [ "90:name *? 'Firefox'", "90:name *? 'Terminal'", "100:class_g 'Xephyr'" ]。blur-background = true; blur-kern = "3x3box"(轻量模糊)。backend = glx
vsync = true
shadow = true
fade = true
opacity-rule = [
"90:name *? 'Firefox'",
"90:name *? 'Terminal'",
"100:class_g 'Xephyr'"
]
shadow-exclude = [
"name 'Notification'",
"class_g ? 'Dmenu'",
"class_g ? 'Dunst'",
"_NET_WM_STATE@:32a * '_NET_WM_STATE_HIDDEN'",
"_GTK_FRAME_EXTENTS@:c"
]
# 可选:背景模糊
# blur-background = true
# blur-kern = "3x3box"
修改后执行 killall compton && compton & 生效。三 性能优化与故障排查
cpulimit 限制 Compton 的 CPU 使用率,例如 cpulimit -l 50 -p $(pgrep compton)(将上限设为 50%)。ps -e | grep compton;无输出则未运行。killall compton && compton &;若配置有误,终端会输出错误信息,按提示修正。四 进阶用法
[Unit]
Description=Compton Window Composer
After=xorg.service
[Service]
ExecStart=/usr/bin/compton --config /etc/compton.conf
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload && sudo systemctl enable --now compton。