Installing Compton on Ubuntu
To use Compton on Ubuntu, start by installing it via the 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.
Configuration File Setup
Compton’s primary configuration file is located at ~/.config/compton.conf. If this file doesn’t exist, create it using a text editor (e.g., nano):
mkdir -p ~/.config && nano ~/.config/compton.conf
The file uses a key-value format, where each line defines a specific setting (e.g., shadow true to enable window shadows). You can also override the default config file path when launching Compton using the --config parameter (e.g., compton --config /path/to/custom.conf).
Common Configuration Options
Below are essential options to customize Compton’s behavior, explained with example values:
shadow = true # Enable shadows
shadow-exclude = ["class_g = 'GtkWindow'"] # Exclude GTK windows from shadows
shadow-radius = 10.0 # Blur radius of shadows (higher = softer)
shadow-color = "#00000080" # Shadow color (hex format with alpha)
shadow-offset-x = 2 # Horizontal shadow offset
shadow-offset-y = 2 # Vertical shadow offset
opacity = 0.9 # Default window opacity (1.0 = fully opaque, 0.0 = fully transparent)
opacity-rule = ["class_g = 'Firefox'", "90", "class_g = 'GIMP'", "80"] # Set opacity for specific apps
fade = true # Enable window fading
fade-delta = 5 # Speed of fading (lower = faster)
backend = "glx" # Use OpenGL (faster) instead of "xrender"
glx-no-stencil = true # Disable stencil buffer (improves performance)
vsync = true # Enable vertical sync (reduces screen tearing)
disable-xinerama = false # Enable for multi-monitor support (set to true if issues occur)
Save the file after editing to apply your changes.
Applying Configuration Changes
After modifying the config file, restart Compton to load the new settings. Run the following command in the terminal:
killall compton && compton -c ~/.config/compton.conf &
This kills any running Compton processes and starts a new one with your updated config.
Autostarting Compton on Login
To ensure Compton launches automatically when you log in, add it to your startup applications:
compton -c ~/.config/compton.confTroubleshooting Tips
compton -v -c ~/.config/compton.conf
mv ~/.config/compton.conf ~/.config/compton.conf.bak) and restart Compton to use defaults.