Installing Compton on CentOS
To use Compton on CentOS, you first need to install it. The package is available in the EPEL (Extra Packages for Enterprise Linux) repository, which may not be enabled by default. Here’s how to proceed:
sudo yum update -y (for CentOS 7) or sudo dnf update -y (for CentOS 8/9) to ensure your system is up to date.sudo yum install epel-release -y (CentOS 7) or sudo dnf install epel-release -y (CentOS 8/9).sudo yum install compton -y; for CentOS 8/9, use sudo dnf install compton -y.sudo yum groupinstall "Development Tools" mesa-libGL-devel libX11-devel -y, then clone the repository (git clone https://github.com/astraeador/compton.git), create a build directory, and run cmake .. && make && sudo make install.Configuring Compton
Compton’s configuration is managed via a config file (typically ~/.config/compton.conf for user-specific settings or /etc/compton.conf for system-wide defaults). Here are key options and examples:
backend = "glx"; # Use GLX for better performance (recommended for most systems)
shadow = true; # Enable window shadows
shadow-exclude = [".*Firefox.*", ".*gnome-terminal.*"]; # Exclude apps from shadows
opacity = false; # Disable window transparency (improves performance)
vsync = true; # Enable vertical sync to reduce screen tearing
glx-no-stencil = true; # Disable stencil buffer (saves memory)
frame-rate = 30; # Limit frame rate to 30 FPS (adjust based on your GPU)
xrandr-args to match your setup. For example, to extend displays horizontally:xrandr-args = "--output HDMI-1 --auto --right-of eDP-1 --output DP-1 --auto --right-of HDMI-1";
Save the config file after making changes.
Starting and Enabling Compton
You can start Compton manually or set it to launch at boot:
compton -c ~/.config/compton.conf (replace with your config path) to start Compton with your custom settings.sudo nano /etc/systemd/system/compton.service.[Unit]
Description=Compton Window Compositor
After=graphical.target
[Service]
ExecStart=/usr/bin/compton -c ~/.config/compton.conf
Restart=always
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable compton
sudo systemctl start compton
Check the service status with sudo systemctl status compton to ensure it’s running.
Troubleshooting Common Issues
glx-hardware = false in your config file and restart Compton.frame-rate (e.g., to 20) or disable shadows (shadow = false) to reduce resource consumption.shadow = true is set and that no apps are excluded in shadow-exclude.compton --log-level debug to view detailed logs and identify issues.