Ubuntu下使用 Compton 配置多屏显示
一 核心要点
二 步骤一 配置多屏布局
xrandr --queryeDP-1 connected primary 1920x1080+0+0,HDMI-1 connected 2560x1440+1920+0xrandr --output HDMI-1 --auto --right-of eDP-1xrandr --output HDMI-1 --auto --left-of eDP-1xrandr --output HDMI-1 --same-as eDP-1 --autoxrandr --output HDMI-1 --mode 1920x1080xrandr --output HDMI-1 --off三 步骤二 安装并配置 Compton
sudo apt update && sudo apt install comptonmkdir -p ~/.config && cp /etc/xdg/compton.conf ~/.config/compton.conf(若系统自带示例配置)nano ~/.config/compton.confbackend = "glx"
vsync = true
fps-limit = 60
shadow = true
shadow-exclude = [
"class_g = 'gnome-terminal'",
"class_g = 'konsole'",
"class_g = 'xterm'",
"class_g = 'Firefox'"
]
# 可选:若遇到特定程序渲染异常,可尝试关闭相关特性
# glx-no-stencil = true
# glx-copy-from-front = true
compton --config ~/.config/compton.conf --replace &四 步骤三 设置开机自启动
compton --config ~/.config/compton.conf --replacenano ~/.config/systemd/user/compton.service[Unit]
Description=Compton Compositor
After=graphical-session.target
[Service]
ExecStart=/usr/bin/compton --config %h/.config/compton.conf --replace
Restart=on-failure
[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user enable --now compton.service
五 常见问题与优化
compton --replace 接管。monitors.xml 方案)。