在 CentOS 上安装和配置 compton(一个轻量级 X11 合成管理器,常用于 i3 / openbox 等窗口管理器实现透明、阴影、淡入淡出等效果),可以按下面的步骤来。
sudo yum install -y epel-release
CentOS 7 可直接用 yum:
sudo yum install -y compton
⚠️ 注意:
- CentOS 8 / Stream 默认仓库可能没有 compton
- 可用
picom(compton 的 fork)代替
安装 picom:
sudo dnf install -y picom
(下面配置对 compton / picom 基本通用)
Compton 默认读取:
~/.config/compton.conf
创建目录和文件:
mkdir -p ~/.config
vim ~/.config/compton.conf
# 后台运行
daemon = true;
# 透明设置
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
# 阴影
shadow = true;
shadow-opacity = 0.5;
shadow-radius = 10;
shadow-offset-x = -5;
shadow-offset-y = -5;
# 淡入淡出
fading = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
# 刷新率相关
vsync = "opengl-swc";
# 后端
backend = "glx";
compton --config ~/.config/compton.conf
在 ~/.config/i3/config 中加入:
exec --no-startup-id compton --config ~/.config/compton.conf
编辑:
~/.config/openbox/autostart
添加:
compton --config ~/.config/compton.conf &
backend = "xrender" 导致问题,可改 glx直接用 picom,命令基本一致:
picom --config ~/.config/compton.conf
尝试:
backend = "xrender";
vsync = false;
如果你告诉我:
我可以给你更精确的配置和启动方式。