温馨提示×

如何开启debian compton

小樊
45
2026-10-10 19:23:28
栏目: 智能运维

在 Debian 上“开启 Compton”通常指启用 Compton 作为 X11 的复合管理器(用于窗口透明、阴影、动画等)。下面按常见情况说明。


一、安装 Compton

Debian 仓库里包名通常是 compton(较老)或 picom(Compton 的继任者)。

sudo apt update
sudo apt install compton

或推荐使用 picom:

sudo apt install picom

二、基础配置文件

创建配置文件(以 compton 为例):

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

最简示例:

backend = "glx";
opacity-rule = [
  "90:class_g = 'URxvt'",
  "95:class_g = 'Firefox'"
];
shadow = true;
shadow-radius = 12;
shadow-opacity = 0.5;
fade = true;

若用 picom,配置文件路径通常为 ~/.config/picom/picom.conf


三、手动启动 Compton

在终端直接运行:

compton &

或 picom:

picom &

若使用配置文件:

compton --config ~/.config/compton/compton.conf &

四、开机自动启动(常见桌面环境)

1. 使用桌面环境(XFCE / LXDE / KDE / GNOME)

  • 打开「会话和启动」
  • 添加启动项:
    • 名称:Compton
    • 命令:compton --config ~/.config/compton/compton.conf

2. 使用 .xinitrc(startx 用户)

编辑 ~/.xinitrc:

compton --config ~/.config/compton/compton.conf &
exec awesome

(将 awesome 替换为你的窗口管理器)


3. 使用 lightdm(常见)

在 /etc/lightdm/lightdm.conf 中:

[Seat:*]
session-wrapper=compton --config ~/.config/compton/compton.conf

(不推荐全局方式,容易出问题)


五、常见问题

1. 黑屏 / 闪烁

  • 尝试换 backend:
backend = "xrender";

2. 已知窗口管理器自带复合

  • GNOME / KDE:不需要 Compton
  • 只在 i3 / awesome / openbox / bspwm 等才需要

3. 查看是否在运行

ps aux | grep compton

六、推荐替代(2024+)

✅ picom 更活跃、更稳定

picom --config ~/.config/picom/picom.conf

如果你告诉我:

  • 使用的 桌面环境 / 窗口管理器
  • 是否是 Wayland 还是 X11

我可以给你更精确的配置。

0 踩