Installing Compton on Ubuntu
Before configuring Compton for multi-monitor setups, ensure the package is installed. Run the following commands to update your package list and install Compton:
sudo apt update
sudo apt install compton
This installs the latest version of Compton available in Ubuntu’s repositories.
Creating or Editing the Compton Configuration File
Compton’s configuration is managed via a text file typically located at ~/.config/compton.conf. If this file doesn’t exist, create it using a text editor like nano:
nano ~/.config/compton.conf
This file will store all settings for customizing Compton’s behavior, including multi-monitor support.
Configuring Multi-Monitor Support
The most critical step for multi-monitor setups is specifying which displays Compton should manage. Use the xrandr command to list all connected monitors and their names (e.g., HDMI-1, eDP-1):
xrandr
Once you have the monitor names, add the xrandr-output directive to your compton.conf file. For example, if you have two monitors connected via HDMI and DisplayPort, use:
xrandr-output HDMI-1 eDP-1;
This tells Compton to handle both displays. For advanced configurations, you can also specify per-display settings (e.g., different opacity rules for each monitor), though this requires referencing Compton’s official documentation for detailed options.
Additional Recommended Settings
To enhance performance and visual consistency across monitors, include these common settings in your compton.conf:
glx for hardware acceleration (required for smooth multi-monitor performance):backend "glx";
shadow-exclude ["class_g 'Desktop'", "class_g 'Gnome-terminal'", "class_g 'Firefox'"];
opacity-rule ["class_g 'Desktop' A"];
fps-limit 60;
These settings ensure Compton runs efficiently across multiple displays.
Running Compton with the New Configuration
After saving your compton.conf file, start Compton with the following command to apply the settings:
compton -c ~/.config/compton.conf
This launches Compton in the background using your custom configuration. To verify it’s running, check the process list with ps aux | grep compton.
Setting Up Compton for Auto-Start
To ensure Compton launches automatically when you log in, add it to your desktop environment’s startup applications:
compton -c ~/.config/compton.conf as the command.systemd service file (e.g., /etc/systemd/system/compton.service) to manage auto-start, though this is optional for most users.Troubleshooting Common Issues
If you encounter problems (e.g., window flickering, performance lag), try these fixes:
shadow false or tweak shadow-radius and shadow-opacity to reduce GPU load.fps-limit to 30 if your system struggles with 60 FPS.xrender backend (set backend "xrender") if glx causes issues—though this may reduce performance.