Compton是一个流行的X11合成管理器,可以用来调整窗口透明度和其他视觉效果。以下是调整透明度的几种方法:
首先找到或创建Compton配置文件:
~/.config/compton.conf
或 /etc/xdg/compton.conf
添加或修改以下参数:
# 启用透明效果
backend = "glx";
paint-on-overlay = true;
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
# 设置窗口透明度规则
opacity-rule = [
# 格式: [条件]:不透明度(0.1-1)
"90:class_g = 'URxvt'", # URxvt终端90%不透明
"85:class_g = 'XTerm'", # XTerm终端85%不透明
"80:class_g = 'Alacritty'", # Alacritty终端80%不透明
"0:name *= 'zoom'", # Zoom窗口完全透明(不推荐)
"0.8:class_g = 'Rofi'", # Rofi菜单80%不透明
"0.7:class_g = 'Dunst'", # 通知70%不透明
"95:class_g = 'Firefox'", # Firefox 95%不透明
"100:class_g = 'discord'" # Discord完全不透明
];
启动Compton时可以直接指定透明度参数:
compton --backend glx --paint-on-overlay --glx-no-stencil \
--glx-no-rebind-pixmap \
--opacity-rule '90:class_g="URxvt"' \
--opacity-rule '85:class_g="XTerm"'
对于已经运行的窗口,可以使用transset-df
工具动态调整:
安装transset-df
(通常包含在xorg-transset
包中)
使用命令:
transset-df 0.8 # 将鼠标下的窗口设为80%不透明
要针对特定窗口类型设置透明度,可以使用以下方法识别窗口属性:
xprop | grep -i class
然后点击目标窗口,获取其类名用于配置规则。
修改配置后,需要重启Compton使更改生效:
pkill compton && compton -b
或者如果你使用systemd管理:
systemctl --user restart compton
希望这些信息能帮助你调整Compton的透明度设置!