Installing Compton on Ubuntu
To use Compton with any desktop environment on Ubuntu, first install it via the package manager. For Debian-based systems (including Ubuntu), run:
sudo apt update && sudo apt install compton
This installs the latest version available in Ubuntu’s repositories. If you need newer features, consider adding a PPA (e.g., ppa:richardgv/compton) or using picom (a maintained fork of Compton).
General Configuration for Compton
Compton’s primary configuration file is located at ~/.config/compton.conf (create it if it doesn’t exist). Key settings to customize include:
glx (better performance, requires OpenGL) or xrender (more compatible, but slower). Example:backend = "glx";
shadow = true, and exclude problematic windows (e.g., docks, menus) using shadow-exclude. Example:shadow = true;
shadow-exclude = ["class_g = 'Plank'", "class_g = 'KRunner'"];
opacity (1.0 = fully opaque, 0.8 = 80% transparent) or set rules for specific apps (e.g., Firefox):opacity = 0.9;
transparency-rule = ["class_g = 'Firefox'", "class_g = 'Thunderbird'"];
vsync = true) to reduce screen tearing, and disable unneeded effects (e.g., fade = false) for older hardware.Integrating Compton with Specific Desktop Environments
While Compton works with most X11-based desktop environments, each requires slightly different setup to avoid conflicts:
GNOME’s default window manager (Mutter) conflicts with Compton, so you must disable Mutter’s built-in compositing.
~/.config/autostart/compton.desktop with these contents:[Desktop Entry]
Type=Application
Exec=compton -b -c ~/.config/compton.conf
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Compton
Alt + F2, type r, and hit Enter).KDE uses KWin as its window manager, which also includes compositing. To use Compton:
/usr/bin/compton and add the command:compton -b -c ~/.config/compton.conf
XFCE is lightweight and works well with Compton. Disable XFCE’s compositing:
compton -b -c ~/.config/compton.conf
These minimal window managers (Openbox, i3) do not include compositing by default, so Compton integrates seamlessly:
~/.config/openbox/autostart for Openbox, ~/.config/i3/config for i3):compton -b -c ~/.config/compton.conf &
i3-msg restart for i3) to apply changes.Troubleshooting Common Issues
xrender (less resource-intensive but less smooth).shadow = false) or transparency (opacity = 1.0).frame-rate = 30).compton -c ~/.config/compton.conf -v) and validate your config file syntax (e.g., ensure no missing semicolons or brackets).Note on Compton’s Status
Compton is no longer actively maintained, and Ubuntu recommends using picom (a fork with bug fixes and new features) as a replacement. Installation and configuration are similar to Compton, but check the picom documentation for updated options.