Installing Compton on Ubuntu
To begin, install Compton using Ubuntu’s package manager. Open a terminal and run:
sudo apt update && sudo apt install compton
This command installs the latest version of Compton available in Ubuntu’s repositories.
Configuring Compton for GNOME
Compton’s behavior is controlled by a configuration file typically located at ~/.config/compton.conf. If this directory or file doesn’t exist, create it:
mkdir -p ~/.config && nano ~/.config/compton.conf
Add the following essential settings to balance performance and aesthetics. These settings enable OpenGL rendering (for smoother animations), exclude Firefox from shadows (to avoid visual glitches), and enable fading for window transitions:
backend = "glx";
shadow-exclude = ["class='.*Firefox'"];
fade = true;
fade-delta = 30;
Save the file (Ctrl+O, Enter) and exit the editor (Ctrl+X). For advanced customization, refer to Compton’s official documentation to tweak parameters like shadow opacity (shadow-opacity), refresh rate (force-frame-rate), or transparency thresholds (alpha-threshold).
Starting Compton Automatically in GNOME
To ensure Compton launches every time you log into GNOME, add it to your startup applications. You can do this via the terminal or GNOME’s graphical interface:
compton --config ~/.config/compton.conf
~/.config/autostart:echo -e "[Desktop Entry]\nType=Application\nExec=compton --config ~/.config/compton.conf\nHidden=false\nNoDisplay=false\nX-GNOME-Autostart-enabled=true\nName=Compton" > ~/.config/autostart/compton.desktop
This ensures Compton starts silently in the background with your custom configuration.Verifying the Setup
After logging out and back in (or running compton --config ~/.config/compton.conf manually), check if Compton is active. You should see window shadows (unless excluded) and smooth fade effects when minimizing/maximizing windows. If you encounter issues (e.g., window flickering), press Alt+F2, type r, and press Enter to restart GNOME Shell—this often resolves temporary glitches.
Troubleshooting Common Issues
glx to xrender in the configuration file (change backend = "glx" to backend = "xrender"). This reduces GPU load but may disable some advanced effects.shadow-exclude doesn’t include the application you want shadows for. For example, to add Chrome to the exclusion list, modify the line to:shadow-exclude = ["class='.*Firefox'", "class='.*Chrome'"];
compton --config ~/.config/compton.conf --log-level debug to view detailed logs and identify errors.