温馨提示×

centos compton在哪配置

小樊
45
2026-09-24 12:08:19
栏目: 智能运维

在 CentOS 上,Compton(现在多称为 picom)的配置文件位置和常见配置方式如下:


一、Compton 配置文件位置

1️⃣ 用户级配置(推荐)

~/.config/compton.conf

或(新版 picom):

~/.config/picom.conf

如果不存在,可以手动创建:

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

2️⃣ 系统级配置(不推荐,影响所有用户)

/etc/compton.conf

或

/etc/xdg/compton.conf

二、Compton 是从哪读取配置的?

启动方式决定读取哪个配置:

常见启动方式

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

如果不指定 --config,默认读取:

  • ~/.config/compton.conf
  • 或 /etc/xdg/compton.conf

三、示例配置(常用)

# 开启阴影
shadow = true;
shadow-radius = 12;
shadow-opacity = 0.5;

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

# 后台运行
daemon = true;

# 使用 GLX 后端(性能更好)
backend = "glx";
vsync = true;

四、CentOS 上安装 Compton

CentOS 7(EPEL)

yum install -y epel-release
yum install -y compton

CentOS 8 / Stream

dnf install -y compton

或(更推荐 picom):

dnf install -y picom

五、开机自动启动

在 ~/.xinitrc 或窗口管理器启动脚本中加入:

compton &

或

picom &

六、检查是否生效

ps aux | grep compton

如果你用的是 GNOME / KDE / i3 / Openbox,我可以给你对应环境的配置示例。

0 踩