在 Linux 上,Compton 是一个轻量级的 X11 合成管理器(现在很多发行版已改名为 picom,配置基本兼容)。下面给你一份实用、可复制的 compton 配置说明和示例。
默认读取:
~/.config/compton.conf
如果没有就新建:
mkdir -p ~/.config
touch ~/.config/compton.conf
# 后台运行
daemon = true;
# 阴影
shadow = true;
shadow-radius = 12;
shadow-offset-x = -4;
shadow-offset-y = -4;
shadow-opacity = 0.5;
# 透明
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
# 淡入淡出
fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
# 避免某些窗口有阴影
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g = 'Dmenu'"
];
# 性能相关
vsync = true;
unredir-if-possible = true;
# 后端
backend = "glx";
glx-no-stencil = true;
shadow = true;
shadow-radius = 10;
shadow-opacity = 0.4;
关闭阴影:
shadow = false;
opacity-rule = [
"80:class_g = 'Alacritty'",
"90:class_g = 'Thunar'"
];
格式:
透明度:条件
shadow-exclude = [
"class_g = 'Dmenu'",
"class_g = 'Polybar'",
"_NET_WM_STATE@:32a *= '_NET_WM_STATE_FULLSCREEN'"
];
unredir-if-possible = true;
vsync = true;
compton --config ~/.config/compton.conf
compton --config ~/.config/compton.conf &
在 i3 / bspwm / openbox 的 autostart 里加一行即可。
试试:
backend = "xrender";
用 picom:
picom --config ~/.config/compton.conf
配置完全通用。
如果你愿意,可以告诉我:
我可以直接帮你写一份针对性配置。