Installing Compton on Debian
Before configuring Compton, you need to install it on your Debian system. Open a terminal and run the following commands to update your package list and install Compton:
sudo apt update
sudo apt install compton
This installs Compton along with essential dependencies for window composition.
Configuring Compton
The primary configuration file for Compton is located at ~/.config/compton.conf
. If this file doesn’t exist, create it using a text editor like nano
:
mkdir -p ~/.config
nano ~/.config/compton.conf
Below are key configuration options to customize Compton’s behavior:
Backend Selection: The backend
option determines how Compton renders windows. For better performance, use glx
(OpenGL) if your hardware supports it; otherwise, use xrender
(software rendering). Example:
backend = "glx"
Shadows: Enable or disable window shadows with the shadow
option. To exclude specific windows (e.g., menus, notifications) from shadows, use shadow-exclude
. Example:
shadow = true
shadow-exclude = ["class_g = 'GtkWindow'", "class_g = 'GtkDialog'"]
shadow-radius = 5 # Adjust shadow softness
shadow-offset-x = 2 # Horizontal shadow offset
shadow-offset-y = 2 # Vertical shadow offset
Transparency: Control window transparency with opacity
. Set opacity
to a value between 0 (fully transparent) and 1 (fully opaque). Use alpha
to adjust the transparency of inactive windows. Example:
opacity = 0.8
alpha = 0.7
ignore-root = true # Ignore root window transparency (fixes compatibility issues)
Vertical Sync (VSync): Enable VSync to prevent screen tearing. Set vsync
to true
(recommended for most users). Example:
vsync = true
Background Blur: Add a blur effect to the desktop background with blur-background
and blur-kern
. Example:
blur-background = true
blur-kern = "3x3box" # Blur kernel size (adjust for performance)
Save the file after making changes.
Starting and Enabling Compton Autostart
To apply your configuration, start Compton manually using the following command (replace ~/.config/compton.conf
with your config file path if different):
compton --config ~/.config/compton.conf
For automatic startup on login, create a systemd service file:
sudo nano /etc/systemd/system/compton.service
Add the following content (replace YourUsername
with your actual username):
[Unit]
Description=Compton Window Compositor
After=display-manager.service
[Service]
ExecStart=/usr/bin/compton --config ~/.config/compton.conf
Restart=always
User=YourUsername
[Install]
WantedBy=multi-user.target
Save the file, then enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable compton
sudo systemctl start compton
Verifying Compton Status
Check if Compton is running using:
systemctl status compton
If the service is active, Compton is working correctly.
Troubleshooting Tips
xrender
or disabling effects like shadows/blurs.backend = "wayland"
).man compton
) for advanced options and debugging.