首页主机资讯ubuntu compton设置选项

ubuntu compton设置选项

时间2025-10-04 06:13:03发布访客分类主机资讯浏览254
导读:Compton Configuration Options for Ubuntu Compton is a lightweight window compositor for X11 that enhances desktop visual...

Compton Configuration Options for Ubuntu

Compton is a lightweight window compositor for X11 that enhances desktop visuals with effects like transparency, shadows, and fading. Below is a structured guide to its key configuration options, setup steps, and optimization tips for Ubuntu.

1. Installation

Before configuring, install Compton using Ubuntu’s package manager:

sudo apt update &
    &
     sudo apt install compton

2. Configuration File Location

Compton’s primary user-specific config file is located at ~/.config/compton.conf. If it doesn’t exist, create it with a text editor (e.g., nano ~/.config/compton.conf). System-wide configs can be found at /etc/xdg/compton.conf (for all users) or ~/.compton.conf (legacy path).

3. Common Configuration Options

Below are essential options to customize Compton’s behavior, grouped by category:

A. Basic Settings

  • backend: Defines the rendering backend. Choose between:
    • xrender (default, better compatibility but slower)
    • glx (faster performance, recommended for modern GPUs).
      Example: backend = "glx".
  • vsync: Enables vertical synchronization to reduce screen tearing. Set to true (recommended) or false. For better performance, use vsync = "opengl-swc" (OpenGL swapchain wait).
  • shadow: Toggles window shadows. Set to true to enable (with customizable radius/offset) or false to disable (improves performance). Example: shadow = true.
  • opacity: Controls window transparency. Use inactive-opacity (for inactive windows, e.g., 0.8) and active-opacity (for active windows, e.g., 1.0). Set to 1.0 to disable transparency entirely.
  • ignore_root: Ignores transparency for the root window (prevents issues in some desktop environments like GNOME). Set to true if you experience graphical glitches.

B. Visual Effects

  • shadow-radius: Adjusts shadow blurriness (default: 12). Lower values make shadows sharper; higher values create a softer effect.
  • shadow-offset-x/y: Sets shadow offset from the window edge (default: -15 for both). Negative values place shadows inside the window; positive values place them outside.
  • shadow-opacity: Controls shadow transparency (default: 0.75). Lower values make shadows fainter; higher values make them more pronounced.
  • fade-in/out: Enables window fade effects when opening/closing. Set to true for smooth transitions (recommended) or false to disable.
  • fade-delta: Adjusts fade speed (default: 5). Lower values make fades faster; higher values make them slower.

C. Performance Optimization

  • glx-no-stencil: Disables stencil buffer usage (reduces GPU memory load). Set to true for better performance on older GPUs.
  • glx-no-rebind-pixmap: Prevents unnecessary pixmap rebinding (improves frame rate). Set to true.
  • xrender-sync-fence: Enables X11 sync fences (reduces tearing with xrender backend). Set to true if using backend = "xrender".
  • unredir-if-possible: Disables composition for fullscreen windows (e.g., games) to improve performance. Set to true and add exceptions (e.g., media players) to unredir-if-possible-exclude.
  • max-cpu-usage: Caps CPU usage (default: 80%). Set to a lower value (e.g., 60) if Compton is consuming too many resources.

D. Advanced: Window-Specific Rules

  • shadow-exclude: Excludes specific windows from shadows (e.g., notifications, docks). Use a list of conditions:
    shadow-exclude = [
        "name = 'Notification'",
        "class_g = 'Conky'",
        "class_g = 'Cairo-clock'"
    ];
        
    
  • opacity-rule: Sets transparency for specific applications. Use class names (find them with xprop | grep WM_CLASS):
    opacity-rule = [
        "90:class_g = 'Alacritty'",  # Terminal at 90% opacity
        "80:class_g = 'URxvt'"       # Another terminal at 80%
    ];
        
    

4. Applying Changes

After editing the config file, restart Compton to apply changes:

pkill compton &
    &
     compton -b

For Systemd users (to auto-start Compton on boot), create a service file:

sudo nano /etc/systemd/system/compton.service

Add this content (replace with your config path if needed):

[Unit]
Description=Compton Window Composer
After=xorg.service

[Service]
ExecStart=/usr/bin/compton --config /home/yourusername/.config/compton.conf
Restart=on-failure

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable compton
sudo systemctl start compton

5. Troubleshooting Tips

  • Screen Tearing: Ensure vsync is enabled (vsync = "opengl-swc") and try different backends (glx vs. xrender).
  • High CPU Usage: Disable unnecessary effects (e.g., shadow = false, fade-in/out = false) and optimize GPU usage with glx-no-stencil = true.
  • Application Glitches: Add problematic apps to shadow-exclude or opacity-rule (e.g., Conky, notification daemons).

This guide covers the most essential Compton options for Ubuntu users. For advanced customization, refer to the official documentation or run compton --help to explore additional parameters.

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: ubuntu compton设置选项
本文地址: https://pptw.com/jishu/719657.html
Linux反引号与子进程的关系 ubuntu compton稳定吗

游客 回复需填写必要信息