ubuntu

Ubuntu下Compton配置全屏显示技巧

小樊
41
2025-08-11 11:18:01
栏目: 智能运维

以下是在Ubuntu下配置Compton实现全屏显示的技巧:

安装Compton

sudo apt install compton

配置文件设置

创建或编辑~/.config/compton.conf文件,添加以下内容:

# 启用OpenGL后端和垂直同步
backend "glx"
vsync true
vsync-type "opengl-swc"

# 关闭阴影和透明以降低GPU负载
shadow false
opacity 1.0

# 允许全屏窗口绕过Compton合成
no-ewmh-fullscreen true
unredir-if-possible true

排除特定全屏应用(可选)

如果需要对某些全屏应用进行特殊处理,可在配置文件中添加排除规则:

unredir-if-possible-exclude = [
  "class_g = '特定应用类名'"
]

可通过xprop命令获取应用窗口的类名。

启动Compton

手动启动:compton --config ~/.config/compton.conf -b

设置开机自启动,可创建/etc/systemd/system/compton.service文件,添加以下内容:

[Unit]
Description=Compton Window Composer
After=display-manager.service

[Service]
ExecStart=/usr/bin/compton --config ~/.config/compton.conf
Restart=always

[Install]
WantedBy=multi-user.target

然后执行以下命令启用并启动服务:

sudo systemctl daemon-reload
sudo systemctl enable compton
sudo systemctl start compton

0
看了该问题的人还看了