Installing Compton on Ubuntu
To use Compton on Ubuntu, start by installing it via the APT package manager (the most common method for Debian-based systems). Open a terminal and run:
sudo apt update && sudo apt install compton
This command updates your package list and installs Compton along with its dependencies. For users preferring Snap, you can install Compton via Snapcraft (though APT is recommended for better integration):
sudo snap install compton
After installation, verify it’s installed correctly by checking the version:
compton --version
Configuring Compton
Compton’s default configuration file is located at ~/.config/compton.conf (create it if it doesn’t exist). You can edit this file using a text editor like nano:
nano ~/.config/compton.conf
Key parameters to customize include:
glx (for OpenGL acceleration, better performance) or xrender (software rendering, more compatible). Example:backend = "glx";
shadow = true; (enable) or shadow = false; (disable). To exclude specific windows (e.g., desktop panels), add:shadow-exclude = ["class_g = 'gnome-panel'"];
opacity = 0.8; (80% opaque) or disable it entirely with opacity = 1.0;.vsync = true; (may increase latency slightly).Save changes and exit the editor (Ctrl+O, Enter, Ctrl+X in nano).
Starting and Enabling Compton
To start Compton manually, run:
compton &
The & runs it in the background. To stop Compton, find its process ID (PID) and kill it:
killall compton
For automatic startup on login, add Compton to your system’s startup applications:
compton --config ~/.config/compton.conf.Alternatively, create a Systemd service for Compton (advanced users):
sudo nano /etc/systemd/system/compton.service
~ with your home directory path):[Unit]
Description=Compton Window Compositor
After=graphical.target
[Service]
ExecStart=/usr/bin/compton --config /home/your-username/.config/compton.conf
Restart=always
User=your-username
[Install]
WantedBy=multi-user.target
sudo systemctl enable compton && sudo systemctl start compton
Troubleshooting Common Issues
shadow = false;, opacity = 1.0;) or switch to a lighter desktop environment (e.g., Xfce).glx as the backend (instead of xrender), enable GPU acceleration (via backend = "glx";), and limit Compton’s CPU usage with cpulimit (install via sudo apt install cpulimit and run cpulimit -l 50 -p $(pgrep compton) to cap it at 50%).