Compton 是一个轻量级的 X11 合成管理器,可以显著改善 Linux 桌面的视觉效果和性能。以下是一些优化 Compton 图形性能的方法:
启用后端选择:
backend = "glx"; # 或 "xrender"(对老旧硬件更友好)
调整刷新率:
vsync = true;
refresh-rate = 0; # 自动检测,或手动设置为显示器刷新率
GLX 后端优化:
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
glx-swap-method = "buffer-age"; # 或 "exchange"
减少阴影效果开销:
shadow = true; # 禁用可提升性能
shadow-radius = 12;
shadow-offset-x = -15;
shadow-offset-y = -15;
shadow-opacity = 0.8;
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g ?= 'Notify-osd'",
"class_g = 'Cairo-clock'",
"_GTK_FRAME_EXTENTS@:c"
];
透明度优化:
inactive-opacity = 1.0;
active-opacity = 1.0;
frame-opacity = 1.0;
opacity-rule = [
"100:class_g = 'URxvt'",
"100:class_g = 'XTerm'"
];
排除不需要合成的窗口:
no-dock-shadow = true;
no-dnd-shadow = true;
clear-shadow = true;
detect-rounded-corners = true;
detect-client-opacity = true;
Intel 集成显卡:
backend = "glx";
glx-no-stencil = true;
glx-copy-from-front = false;
glx-swap-method = "buffer-age";
NVIDIA 显卡:
backend = "glx";
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
glx-swap-method = "exchange";
AMD 显卡:
backend = "glx";
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
glx-swap-method = "undefined";
启动时添加 --benchmark
参数测试性能:
compton --benchmark 200
使用 --log-level
参数查看详细日志:
compton --log-level DEBUG
监控性能影响:
watch -n 1 cat /proc/*/stat | grep -E "Xorg|compton"
backend = "glx";
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
use-damage = true;
vsync = true;
shadow = false;
fading = false;
dbe = false;
mark-wmwin-focused = true;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
根据您的硬件和需求调整这些设置,通常需要在视觉效果和性能之间找到平衡点。