Debian Compton的自定义设置
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, useglx
(OpenGL) instead of the defaultxrender
:backend = "glx"
Note: On Wayland, use
wayland
instead ofglx
. -
Shadows: Enable or disable window shadows with the
shadow
option. 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
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
andblur-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 = glx
is 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
cpulimit
to 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.
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: Debian Compton的自定义设置
本文地址: https://pptw.com/jishu/731133.html