首页/发现新知
视界 · 深度阅读

centos compton该咋配置

在 CentOS 上配置 Compton(现在更多叫 picom)通常用于给窗口管理器(如 i3、Openbox、awesome 等)提供透明、阴影、模糊等合成效果。下面按常见场景给你一个清晰配置指南。


一、安装 Compton / picom

CentOS 7

sudo yum install epel-release
sudo yum install compton

CentOS 8 / Stream

sudo dnf install epel-release
sudo dnf install compton

如果仓库里没有,可以用 picom(Compton 的 fork):

sudo dnf install picom

二、基本启动方式

如果你是 i3 / Openbox / awesome 用户,在配置文件中加入:

compton &

或

picom &

手动测试:

compton --config ~/.config/compton.conf

三、配置文件(推荐)

配置文件路径:

~/.config/compton.conf

最基础配置示例

backend = "glx";
glx-no-stencil = true;

shadow = true;
shadow-radius = 12;
shadow-offset-x = -2;
shadow-offset-y = -2;
shadow-opacity = 0.5;

opacity-rule = [
  "90:class_g = 'URxvt'",
  "95:class_g = 'Firefox'"
];

fade = true;
fade-in-step = 0.03;
fade-out-step = 0.03;

vsync = true;

四、常见功能配置

1️⃣ 窗口透明

opacity-rule = [
  "80:class_g = 'Terminal'",
  "100:class_g = 'Firefox'"
];

2️⃣ 阴影(推荐)

shadow = true;
shadow-radius = 10;
shadow-opacity = 0.45;

3️⃣ 模糊(需要 picom)

blur-method = "gaussian";
blur-strength = 10;

4️⃣ 排除某些窗口

shadow-exclude = [
  "name = 'Notification'"
];

五、和窗口管理器配合

i3 示例

在 ~/.config/i3/config:

exec --no-startup-id compton

Openbox

在 ~/.config/openbox/autostart:

compton &

六、常见问题

❌ 黑屏 / 卡顿

尝试:

backend = "xrender";

或关闭 vsync:

vsync = false;

❌ 透明无效

确认:

  • 使用的是 复合窗口管理器
  • 终端支持透明(如 urxvt / alacritty)

七、推荐现代方案(新系统)

如果你是新装系统,建议直接用 picom:

sudo dnf install picom
picom --experimental-backends

如果你能告诉我:

  • CentOS 版本
  • 用的窗口管理器(i3 / GNOME / KDE / Openbox)
  • 想要的效果(透明 / 阴影 / 模糊)

我可以直接给你一份可用配置。

读到这里,发现更多一点。探索更多内容 ↗