Compton是一個輕量級的X11合成窗口管理器,用于提供窗口透明、陰影、淡入淡出等視覺效果。以下是對Ubuntu系統中Compton配置文件的詳細解讀:
~/.config/compton.conf
。如果該文件不存在,可以手動創建。cd ~
。nano
編輯器:nano ~/.config/compton.conf
。glx
或xrender
。true
(開啟)或false
(關閉)。true
(開啟)或false
(關閉)。0.0
(完全透明)到1.0
(完全不透明)。true
以忽略根窗口的透明度設置。# 基本設置
backend = "glx";
paint-on-overlay = true;
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
vsync = "opengl-swc";
# 陰影設置
shadow = true;
no-dock-shadow = true;
no-dnd-shadow = true;
shadow-radius = 7;
shadow-offset-x = -7;
shadow-offset-y = -7;
shadow-opacity = 0.7;
shadow-red = 0.0;
shadow-green = 0.0;
shadow-blue = 0.0;
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g ?= 'Notify-osd'",
"class_g = 'Cairo-clock'",
"_GTK_FRAME_EXTENTS@:c"
];
# 淡入淡出效果
fading = true;
fade-delta = 4;
fade-in-step = 0.03;
fade-out-step = 0.03;
fade-exclude = [ ];
# 透明度設置
inactive-opacity = 0.8;
active-opacity = 1.0;
frame-opacity = 0.7;
inactive-opacity-override = false;
opacity-rule = [
"90:class_g = 'Alacritty'",
"80:class_g = 'URxvt'"
];
# 其他設置
detect-rounded-corners = true;
detect-client-opacity = true;
refresh-rate = 0;
dbe = false;
unredir-if-possible = true;
focus-exclude = [ "class_g = 'Cairo-clock'" ];
mark-wmwin-focused = true;
mark-ovredir-focused = true;
detect-transient = true;
detect-client-leader = true;
use-ewmh-active-win = true;
invert-color-include = [ ];
# 窗口類型設置
wintypes:
{
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; };
};
compton --config ~/.config/compton.conf -b
。~/.xinitrc
:compton --config ~/.config/compton.conf -b &
。i3wm
(添加到~/.config/i3/config
):exec --no-startup-id compton --config ~/.config/compton.conf -b
。-b
:作為后臺守護進程運行。--config <path>
:指定配置文件路徑。--backend <backend>
:指定后端(glx
, xrender
等)。--vsync <method>
:設置垂直同步方法。--shadow-exclude <pattern>
:排除特定窗口的陰影。--opacity-rule <rule>
:設置特定窗口的透明度規則。通過以上步驟和配置示例,你可以根據自己的需求調整Compton的設置,以獲得最佳的視覺效果和性能。