Installing Compton on Debian
Before customizing Compton, ensure it’s installed on your Debian system. Run the following commands to update your package list and install Compton:
sudo apt update
sudo apt install compton
This installs the latest stable version of Compton from Debian’s official repositories.
Creating/Editing the Configuration File
Compton’s default 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
touch ~/.config/compton.conf
nano ~/.config/compton.conf
This file stores all customizable settings for Compton, from visual effects to performance optimizations.
Common Customization Options
Below are key configuration options to tailor Compton to your needs:
Backend Selection: The backend option determines how Compton renders windows. For better performance, use glx (OpenGL) instead of the default xrender:
backend = "glx"
Note: On Wayland, use wayland instead of glx.
Shadows: Enable or disable window shadows with the shadow option. To exclude specific windows (e.g., panels, dialogs) from shadows, use shadow-exclude:
shadow = true
shadow-exclude = ["class_g = 'GtkWindow'", "class_g = 'GtkDialog'"]
Adjust the shadow-radius (blur intensity), shadow-dx/shadow-dy (offset) to fine-tune shadow appearance.
Transparency: Control window transparency with opacity. Set it to a value between 0.0 (fully transparent) and 1.0 (fully opaque). For per-window rules, use opacity-rule:
opacity = 0.8
opacity-rule = ["90:class_g = 'Firefox'", "100:class_g = 'Xephyr'"]
This sets Firefox to 90% opacity and Xephyr to 100% opacity.
Vertical Sync (VSync): Enable VSync to reduce screen tearing with the vsync option:
vsync = true
Disable it if you experience lag or input delay.
Background Blur: Add a blur effect to inactive windows or the desktop background using blur-background and blur-kern:
blur-background = true
blur-kern = "3x3box"
Experiment with kernel sizes (e.g., 5x5gaussian) for different blur intensities.
Applying Custom Configurations
After editing ~/.config/compton.conf, save the file and restart Compton to apply changes. You can do this by killing the current process and restarting it:
pkill compton
compton -c ~/.config/compton.conf &
The -c flag tells Compton to use your custom configuration file.
Setting Up Systemd for Autostart
To ensure Compton launches automatically after login, create a systemd service file:
sudo nano /etc/systemd/system/compton.service
Add the following content (replace your_username with your actual username):
[Unit]
Description=Compton Compositor
After=display-manager.service
[Service]
ExecStart=/usr/bin/compton -c /home/your_username/.config/compton.conf
Restart=always
User=your_username
[Install]
WantedBy=multi-user.target
Save the file, then enable and start the service:
sudo systemctl enable compton.service
sudo systemctl start compton.service
This ensures Compton runs on every boot.
Performance Optimization Tips
To keep Compton running smoothly, especially on older hardware, follow these tips:
backend = glx is set (as mentioned earlier) and your graphics drivers are up to date.shadow = false) or transparency (opacity = 1.0) if you don’t need them.cpulimit to restrict Compton’s CPU usage (e.g., limit to 50%):cpulimit -l 50 -p $(pgrep compton)
libgl1-mesa-dev) updated to benefit from performance improvements.