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
backendoption determines how Compton renders windows. For better performance, useglx(OpenGL) if your hardware supports it; otherwise, usexrender(software rendering). Example:backend = "glx" -
Shadows: Enable or disable window shadows with the
shadowoption. To exclude specific windows (e.g., menus, notifications) from shadows, useshadow-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. Setopacityto a value between 0 (fully transparent) and 1 (fully opaque). Usealphato 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
vsynctotrue(recommended for most users). Example:vsync = true -
Background Blur: Add a blur effect to the desktop background with
blur-backgroundandblur-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
- If Compton causes lag or high CPU usage, try switching the backend to
xrenderor disabling effects like shadows/blurs. - For Wayland users, ensure your desktop environment (e.g., GNOME, KDE) is compatible with Compton’s Wayland backend (
backend = "wayland"). - Refer to the official Compton documentation or man page (
man compton) for advanced options and debugging.
以上就是关于“Debian系统中Compton怎么设置”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm