在 Linux 上让 Compton(或已更名为 Picom) 实现窗口/桌面透明,通常分为三类:窗口透明、桌面背景透明、整体效果透明。下面按常见用法说明。
# Debian / Ubuntu
sudo apt install compton
# 或使用 picom(新版本)
sudo apt install picom
# Arch
sudo pacman -S picom
现代系统推荐直接用
picom,compton 已停止维护。
配置文件一般位于:
~/.config/compton.conf
# 或
~/.config/picom.conf
最小配置示例:
backend = "glx";
glx-no-stencil = true;
opacity-rule = [
"0.9"
];
这样所有窗口都是 90% 不透明。
opacity-rule = [
"90:class_g = 'URxvt'",
"80:class_g = 'Alacritty'",
"70:class_g = 'Termite'",
"95:class_g = 'Firefox'"
];
含义:
inactive-opacity = 0.8;
active-opacity = 1.0;
如果你用的是 i3 / bspwm / openbox 等,没有原生桌面:
opacity-rule = [
"85:class_g = 'URxvt' || class_g = 'Alacritty'"
];
feh 设置壁纸feh --bg-scale ~/wallpaper.png
Compton 本身不能让桌面容器透明,只能让窗口透明。
如果你想要:
需要:
xcompmgrblur:
{
method = "gaussian";
size = 10;
deviation = 5.0;
};
opacity-rule = [
"90:class_g = 'Alacritty'"
];
效果:
compton &
# 或
picom &
写入 ~/.xinitrc 或 i3 配置:
exec --no-startup-id picom
unredir-if-possible = true;
如果你告诉我:
我可以直接给你一份可用配置。