在 Linux 下使用 Compton(现在多数发行版已更名为 picom,但配置方式基本一致)做窗口合成器时,配置主要通过配置文件 + 命令行参数来完成。
下面按「从零开始」给你讲清楚。
sudo apt install compton
# 或新版
sudo apt install picom
sudo pacman -S picom
sudo dnf install picom
默认读取配置文件(任意一个即可):
~/.config/compton.conf
~/.config/picom.conf
/etc/xdg/compton.conf
如果是 picom:
~/.config/picom.conf
picom --example > ~/.config/picom.conf
# 或
compton --example > ~/.config/compton.conf
shadow = true;
shadow-radius = 12;
shadow-opacity = 0.5;
shadow-offset-x = -4;
shadow-offset-y = -4;
opacity-rule = [
"90:class_g = 'URxvt'",
"95:class_g = 'Firefox'"
];
或全局透明(不推荐):
inactive-opacity = 0.9;
active-opacity = 1.0;
backend = "glx";
blur-method = "gaussian";
blur-strength = 10;
fade = true;
fade-in-step = 0.03;
fade-out-step = 0.03;
unredir-if-possible = true;
compton &
# 或
picom &
picom --config ~/.config/picom.conf
在 ~/.config/i3/config 中:
exec --no-startup-id picom
ps aux | grep picom
backend = "xrender";
backend = "glx";
vsync = true;
backend = "glx";
shadow = true;
fade = true;
unredir-if-possible = true;
vsync = true;
如果你用的是 i3 / bspwm / openbox / KDE / GNOME,或者想做毛玻璃效果 / 游戏不掉帧,可以告诉我你的桌面环境,我可以给你一份针对性配置。