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
backendoption determines how Compton renders windows. For better performance, useglx(OpenGL) instead of the defaultxrender:backend = "glx"Note: On Wayland, use
waylandinstead ofglx. -
Shadows: Enable or disable window shadows with the
shadowoption. To exclude specific windows (e.g., panels, dialogs) from shadows, useshadow-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 between0.0(fully transparent) and1.0(fully opaque). For per-window rules, useopacity-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
vsyncoption:vsync = trueDisable it if you experience lag or input delay.
-
Background Blur: Add a blur effect to inactive windows or the desktop background using
blur-backgroundandblur-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:
- Use GPU Acceleration: Ensure
backend = glxis set (as mentioned earlier) and your graphics drivers are up to date. - Disable Unnecessary Effects: Turn off shadows (
shadow = false) or transparency (opacity = 1.0) if you don’t need them. - Limit Resources: Use
cpulimitto restrict Compton’s CPU usage (e.g., limit to 50%):cpulimit -l 50 -p $(pgrep compton) - Update Dependencies: Keep Compton and its dependencies (e.g.,
libgl1-mesa-dev) updated to benefit from performance improvements.
以上就是关于“Debian Compton的自定义设置”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm