温馨提示×

debian compton怎么开启阴影

小樊
42
2026-09-10 21:05:32
栏目: 智能运维

在 Debian 上,Compton(现在很多发行版已改用其分支 picom)开启窗口阴影,主要通过配置文件来控制。

下面分情况说明:


一、确认你用的是 compton 还是 picom

先看一下命令是否存在:

which compton
which picom
  • picom → 用 picom(配置方式一样,只是命令名不同)
  • 只有 compton → 用 compton

二、创建/编辑配置文件

Compton / Picom 默认读取:

~/.config/compton.conf
# 或
~/.config/picom.conf

如果没有就新建:

mkdir -p ~/.config
touch ~/.config/compton.conf

三、开启阴影的最小配置

编辑 ~/.config/compton.conf

# 开启阴影
shadow = true;

# 阴影偏移
shadow-offset-x = -2;
shadow-offset-y = -2;

# 阴影模糊半径
shadow-blur = 10;

# 阴影透明度(0~1,越小越淡)
shadow-opacity = 0.5;

# 阴影颜色(可选)
shadow-color = "000000";

# 不对以下窗口加阴影(可选)
shadow-exclude = [
  "name = 'Notification'",
  "class_g = 'Conky'",
  "window_type = 'dock'",
  "window_type = 'desktop'"
];

四、启动 compton / picom

手动启动

compton --config ~/.config/compton.conf &
# 或
picom --config ~/.config/compton.conf &

开机自启(以 i3 为例)

~/.config/i3/config 中加:

exec --no-startup-id compton --config ~/.config/compton.conf

五、常见问题

1. 阴影不显示

  • 确认用的是 透明合成器(不是只开 opaque)
  • 确认窗口管理器支持(i3 / Openbox / bspwm 都支持)
  • 确认没有 shadow-exclude 把窗口排除了

2. Debian 老版本 compton

老 compton 用:

shadow = true;

而不是 shadow = yes;

3. 性能问题

模糊半径过大会卡,可减小:

shadow-blur = 4;

如果你愿意,可以告诉我:

  • Debian 版本
  • 桌面环境 / 窗口管理器(i3 / KDE / XFCE 等)
  • 用的是 compton 还是 picom

我可以给你一份可直接用的完整配置

0