通过Compton优化多显示器设置步骤如下:
安装Compton:
基于Debian/Ubuntu系统:sudo apt-get install compton
基于CentOS/RHEL系统:sudo yum install compton。
配置显示器布局:
使用xrandr命令设置多显示器模式(如扩展、镜像),例如:
xrandr --output HDMI-1 --auto --right-of eDP-1(将HDMI-1设为eDP-1右侧)。
将命令保存到启动脚本(如~/.xprofile)实现开机自动应用。
修改Compton配置文件:
编辑~/.config/compton.conf,添加多显示器相关参数:
backend "glx" # 选择GLX渲染引擎
xrandr-args "" # 传递xrandr参数(可选)
shadow-exclude ["class_g \"Desktop\""] # 排除桌面阴影(可选)
保存后重启Compton生效。
启动Compton并设置开机自启:
compton -c ~/.config/compton.conf。/etc/systemd/system/compton.service文件,内容如下:[Unit]
Description=Compton Compositor
After=display-manager.service
[Service]
ExecStart=/usr/bin/compton -c ~/.config/compton.conf
Restart=on-failure
[Install]
WantedBy=multi-user.target
执行sudo systemctl enable --now compton启用服务。优化显示效果:
opacity-rule、shadow-exclude)。backend "glx")提升性能。--record-output(需配合工具使用)。注意:具体配置需根据显卡驱动和显示器型号调整,可通过xrandr --query查看显示器名称,参考Compton官方文档优化参数。