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
Run xrandr --query to 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 194mm
This shows three displays: eDP-1 (laptop screen, primary), HDMI-1 (right of eDP-1), and DP-1 (right of HDMI-1).
Set Up Displays with xrandr
Use xrandr commands to arrange your displays. For example, to extend HDMI-1 and DP-1 to the right of eDP-1, run:
xrandr --output HDMI-1 --auto --right-of eDP-1
xrandr --output DP-1 --auto --right-of HDMI-1
Replace 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.conf
Add or modify the following options to support multi-monitor setups:
glx for hardware acceleration (recommended for better performance with multiple monitors):backend = "glx";
disable-xinerama is set to false (this allows Compton to recognize multiple displays):disable-xinerama = false;
xrandr-output directive. For example, to apply settings to HDMI-1 and DP-1 (linked to eDP-1), add:xrandr-output "HDMI-1" "eDP-1";
xrandr-output "DP-1" "HDMI-1";
This tells Compton to treat HDMI-1 as an extension of eDP-1 and DP-1 as an extension of HDMI-1.Start Compton with the New Configuration
After saving the configuration file, start Compton with the -c flag to specify the config path:
compton -c ~/.config/compton.conf
If 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:
sudo nano /etc/systemd/system/compton.service
~/.config/compton.conf with 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
sudo systemctl daemon-reload
sudo systemctl enable compton.service
sudo systemctl start compton.service
Verify the service status with systemctl status compton.service—it should show as “active (running)”.Troubleshooting Common Issues
xrandr is configured correctly before starting Compton. Run xrandr --query to verify your display layout.shadow = false;) or using a lighter backend (e.g., xrender instead of glx).compton -c ~/.config/compton.conf --log-level debug) and adjust the config file accordingly.