ubuntu

ubuntu compton如何设置窗口阴影

小樊
35
2025-10-26 19:23:33
栏目: 智能运维

Ubuntu Compton设置窗口阴影的完整步骤

1. 安装Compton

首先确保系统已安装Compton(Ubuntu默认仓库通常包含该软件包)。打开终端,运行以下命令安装:

sudo apt update && sudo apt install compton

2. 配置窗口阴影参数

Compton的配置文件默认位于~/.config/compton.conf(若不存在,可手动创建)。使用文本编辑器(如nano)打开配置文件:

nano ~/.config/compton.conf

在文件中添加或修改以下阴影相关参数(关键配置说明见下文):

# 启用窗口阴影(true/false)
shadow = true

# 排除不需要阴影的窗口(如Firefox、gedit等,避免遮挡内容)
shadow-exclude = [
    "class_g = 'Firefox'",
    "class_g = 'gedit'",
    "class_g = 'vlc'"
]

# 设置阴影不透明度(0.0~1.0,1.0为完全不透明)
shadow-opacity = 0.7

# 设置阴影模糊半径(像素,值越大阴影越模糊)
shadow-radius = 8

# 设置阴影水平/垂直偏移量(像素,正值向右/下偏移)
shadow-offset-x = 3
shadow-offset-y = 3

3. 参数详解

4. 应用配置

保存配置文件后,重启Compton以使更改生效:

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

若希望Compton随系统启动自动运行,可创建systemd服务(可选):

sudo nano /etc/systemd/system/compton.service

添加以下内容:

[Unit]
Description=Compton Compositor
After=graphical.target

[Service]
ExecStart=/usr/bin/compton --config /home/你的用户名/.config/compton.conf
Restart=on-failure

[Install]
WantedBy=multi-user.target

保存后启用并启动服务:

sudo systemctl enable compton && sudo systemctl start compton

注意事项

0
看了该问题的人还看了