温馨提示×

centos下compton咋配置

小樊
44
2026-10-20 19:16:54
栏目: 智能运维

在 CentOS 下配置 compton(现在社区更多用 fork 版 picom),大致步骤如下。下面以 compton 为主说明,同时给出 picom 的注意点。


一、安装 compton

1. 启用 EPEL(如果有包)

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

CentOS 8 / Stream 可能仓库里没有 compton,可改用 picom(见后文)。


二、基础配置文件

compton 默认读取:

~/.config/compton.conf

或

~/.compton.conf

示例配置(常用)

# 关闭阴影
shadow = false

# 开启透明
opacity-rule = [
  "90:class_g = 'URxvt'",
  "80:class_g = 'Firefox'"
]

# 后台运行
daemon = true

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

# 合成刷新
vsync = true

# 忽略某些窗口
unredir-if-possible = true

保存为 ~/.config/compton.conf


三、启动 compton

手动启动

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

自动启动(i3 / Openbox 等)

在窗口管理器启动命令里加:

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

四、CentOS 常见注意点

1. 显卡驱动

  • NVIDIA:确保装了 闭源驱动
  • Intel / AMD:一般直接用 Mesa 即可

2. GLX 问题

如果黑屏或卡顿,可改:

backend = "xrender"

3. 没有 compton 包(CentOS 8+)

建议直接用 picom:

sudo dnf install picom

配置文件路径相同:

~/.config/picom.conf

启动:

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

五、调试方法

查看是否运行:

ps aux | grep compton

看日志:

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

如果你能告诉我:

  • CentOS 版本(7 / 8 / Stream)
  • 桌面环境(GNOME / KDE / i3 / 无桌面)

我可以给你 更精确的一套配置。

0 踩