温馨提示×

centos compton怎样设特效

小樊
33
2026-10-26 18:52:08
栏目: 智能运维

在 CentOS 上用 Compton(现在更多叫 picom,Compton 已停止维护)做窗口特效,基本思路是:安装 → 写配置文件 → 启动。下面按“新手可操作”的方式说明。


一、安装 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

或更推荐:

sudo dnf install picom

建议直接用 picom,功能更全。


二、基础配置文件

新建配置文件:

mkdir -p ~/.config/compton
nano ~/.config/compton/compton.conf

最常用特效示例(阴影 + 透明 + 淡入淡出)

# 开启阴影
shadow = true;
shadow-radius = 12;
shadow-offset-x = -5;
shadow-offset-y = -5;
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;

# 渲染优化
backend = "glx";
vsync = true;

# 忽略全屏
unredir-if-possible = true;

三、启动 Compton

手动启动

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

或

picom --config ~/.config/compton/compton.conf &

开机自动启动(轻量桌面)

在 ~/.xinitrc 或桌面环境自启里加:

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

四、常见特效说明

特效 配置项
窗口阴影 shadow = true
圆角窗口 rounded-corners = true(picom 新版本)
模糊背景 blur-method = "gaussian"; blur-strength = 10;
透明终端 opacity-rule
动画 fading = true

五、常见问题

1️⃣ 没效果?

  • 确认用的是 非 GNOME(Wayland)
  • CentOS 默认 GNOME 是 Wayland,Compton 不支持
  • 登录时选 GNOME on Xorg

2️⃣ CPU 占用高?

backend = "xrender";
vsync = false;

3️⃣ 全屏卡?

unredir-if-possible = true;

六、推荐组合(CentOS 轻量桌面)

  • 窗口管理器:i3 / Openbox
  • compositor:picom
  • 面板:tint2 / polybar

如果你告诉我:

  • CentOS 版本
  • 用的桌面(GNOME / KDE / i3 / 无桌面)

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

0 踩