Installing Compton on Debian
Before configuring multi-monitor support, ensure Compton is installed on your Debian system. Run the following commands to update your package list and install Compton:
sudo apt-get update
sudo apt-get install compton
This installs the latest version of Compton available in Debian’s repositories.
Configuring Multi-Monitor Support in Compton
Compton relies on your display layout (configured via xrandr) to manage multiple monitors. Follow these steps to set up multi-monitor support:
-
Verify Display Configuration with
xrandr
Runxrandr --queryto list all connected displays and their current arrangement (e.g., HDMI-1, DP-1, eDP-1). Note the names of your displays and their connections (e.g., “right-of” or “left-of”). For example:HDMI-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 510mm x 287mm DP-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 287mm eDP-1 connected primary 1920x1080+3840+0 (normal left inverted right x axis y axis) 344mm x 194mmThis shows three displays:
eDP-1(laptop screen, primary),HDMI-1(right ofeDP-1), andDP-1(right ofHDMI-1). -
Set Up Displays with
xrandr
Usexrandrcommands to arrange your displays. For example, to extendHDMI-1andDP-1to the right ofeDP-1, run:xrandr --output HDMI-1 --auto --right-of eDP-1 xrandr --output DP-1 --auto --right-of HDMI-1Replace the display names and positions with your desired layout. This step ensures your displays are correctly configured before Compton starts.
-
Edit the Compton Configuration File
Compton’s main configuration file is typically located at~/.config/compton.conf(create it if it doesn’t exist). Open the file with a text editor (e.g.,nano):mkdir -p ~/.config nano ~/.config/compton.confAdd or modify the following options to support multi-monitor setups:
- Specify the Backend: Use
glxfor hardware acceleration (recommended for better performance with multiple monitors):backend = "glx"; - Enable Xinerama Support: If you’re using X11, ensure
disable-xineramais set tofalse(this allows Compton to recognize multiple displays):disable-xinerama = false; - Configure Per-Monitor Rules (Optional): If you want to apply specific settings to certain monitors (e.g., disable shadows on an external display), use the
xrandr-outputdirective. For example, to apply settings toHDMI-1andDP-1(linked toeDP-1), add:This tells Compton to treatxrandr-output "HDMI-1" "eDP-1"; xrandr-output "DP-1" "HDMI-1";HDMI-1as an extension ofeDP-1andDP-1as an extension ofHDMI-1.
- Specify the Backend: Use
-
Start Compton with the New Configuration
After saving the configuration file, start Compton with the-cflag to specify the config path:compton -c ~/.config/compton.confIf Compton is already running, kill the existing process first:
killall compton compton -c ~/.config/compton.conf
Setting Up Compton to Start at Boot
To ensure Compton launches automatically after a reboot, create a systemd service:
- Create a new service file:
sudo nano /etc/systemd/system/compton.service - Add the following content (replace
~/.config/compton.confwith your actual config path if different):[Unit] Description=Compton Window Composer After=display-manager.service [Service] ExecStart=/usr/bin/compton -c ~/.config/compton.conf Restart=on-failure [Install] WantedBy=multi-user.target - Enable and start the service:
Verify the service status withsudo systemctl daemon-reload sudo systemctl enable compton.service sudo systemctl start compton.servicesystemctl status compton.service—it should show as “active (running)”.
Troubleshooting Common Issues
- Displays Not Recognized: Ensure
xrandris configured correctly before starting Compton. Runxrandr --queryto verify your display layout. - Performance Issues: If Compton slows down with multiple monitors, try disabling shadows (
shadow = false;) or using a lighter backend (e.g.,xrenderinstead ofglx). - Configuration Errors: Check the Compton log for errors (run
compton -c ~/.config/compton.conf --log-level debug) and adjust the config file accordingly.
以上就是关于“Compton在Debian上的多显示器设置”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm