以下是在Ubuntu下配置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 --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