温馨提示×

compton在linux怎启动

小樊
46
2026-09-25 01:47:36
栏目: 智能运维

你问的 Compton 一般是指 Linux 下常用的 X11 合成管理器(compositor),用来实现窗口透明、阴影、动画等效果。下面是启动和配置方法。


一、安装 Compton

不同发行版安装命令:

# Debian / Ubuntu
sudo apt install compton

# Arch / Manjaro
sudo pacman -S compton

# Fedora
sudo dnf install compton

注意:新版本很多发行版已改名为 picom(compton 的 fork)

sudo apt install picom

二、直接启动(临时)

compton &

或(picom):

picom &

此时窗口特效会立即生效。


三、开机自动启动(推荐)

1️⃣ 使用 ~/.xinitrc(startx 用户)

在 ~/.xinitrc 里加:

compton &
exec dwm   # 或 i3 / openbox 等

2️⃣ 使用显示管理器(LightDM / SDDM / GDM)

放到 autostart:

i3

在 ~/.config/i3/config:

exec --no-startup-id compton

Openbox

~/.config/openbox/autostart
compton &

通用(XDG autostart)

mkdir -p ~/.config/autostart

创建:

~/.config/autostart/compton.desktop

内容:

[Desktop Entry]
Type=Application
Name=Compton
Exec=compton
X-GNOME-Autostart-enabled=true

四、常用配置文件

~/.config/compton.conf

示例(基础):

backend = "glx";
shadow = true;
fade = true;
opacity-rule = [
  "90:class_g = 'URxvt'"
];

启动指定配置:

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

五、常见问题

❌ Compton 不生效

  • 确保在 X11(不是 Wayland)
  • 不要同时运行多个 compositor(如 mutter、kwin)

✅ 检查是否在运行

ps aux | grep compton

如果你告诉我:

  • 使用的 发行版
  • 窗口管理器(i3 / dwm / openbox / KDE)

我可以给你更精确的启动方式。

0 踩