linux

如何利用Compton配置实现自定义主题

小樊
32
2025-12-10 04:07:42
栏目: 编程语言

Compton 自定义主题的可行路径

一 核心认知

二 快速上手步骤

三 主题化配置示例

# 全局渲染与同步
backend = "glx";
vsync = true;
glx-copy-from-front = false;

# 暗色主题
shadow = true;
shadow-radius = 12;
shadow-offset-x = -6;
shadow-offset-y = 6;
shadow-opacity = 0.30;
blur-background = true;
blur-radius = 8;
blur-kern = "3x3box";
background-opacity = 0.95;

# 亮色主题(如需启用,将整段取消注释并注释上面的暗色段)
# shadow = true;
# shadow-radius = 10;
# shadow-offset-x = -5;
# shadow-offset-y = 5;
# shadow-opacity = 0.22;
# blur-background = true;
# blur-radius = 6;
# blur-kern = "3x3box";
# background-opacity = 0.92;

# 按窗口规则排除阴影(示例:Dock、某些面板)
shadow-exclude = [
  "class_g = 'Polybar'",
  "class_g = 'Conky'",
  "name = 'yakuake'"
];

# 可选:窗口规则(更细粒度控制)
opacity-rule = [
  "90:class_g = 'URxvt' && !_NET_WM_STATE@:a contains '_NET_WM_STATE_FULLSCREEN'",
  "0.85:class_g = 'Firefox' && _NET_WM_STATE@:a contains '_NET_WM_STATE_FULLSCREEN'"
];

四 多主题切换与自启动

[Unit]
Description=Compton Compositor
After=graphical-session.target

[Service]
ExecStart=/usr/bin/compton --config %h/.config/compton-dark.conf
Restart=always

[Install]
WantedBy=graphical-session.target

五 常见问题与排错

0
看了该问题的人还看了