首页主机资讯Compton在Debian上的多显示器设置

Compton在Debian上的多显示器设置

时间2025-10-23 08:39:04发布访客分类主机资讯浏览1336
导读:Installing Compton on Debian Before configuring multi-monitor support, ensure Compton is installed on your Debian system...

Installing Compton on Debian
Before configuring multi-monitor support, ensure Compton is installed on your Debian system. Run the following commands to update your package list and install Compton:

sudo apt-get update
sudo apt-get install compton

This installs the latest version of Compton available in Debian’s repositories.

Configuring Multi-Monitor Support in Compton
Compton relies on your display layout (configured via xrandr) to manage multiple monitors. Follow these steps to set up multi-monitor support:

  1. Verify Display Configuration with xrandr
    Run xrandr --query to list all connected displays and their current arrangement (e.g., HDMI-1, DP-1, eDP-1). Note the names of your displays and their connections (e.g., “right-of” or “left-of”). For example:

    HDMI-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 510mm x 287mm
    DP-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 287mm
    eDP-1 connected primary 1920x1080+3840+0 (normal left inverted right x axis y axis) 344mm x 194mm
    

    This shows three displays: eDP-1 (laptop screen, primary), HDMI-1 (right of eDP-1), and DP-1 (right of HDMI-1).

  2. Set Up Displays with xrandr
    Use xrandr commands to arrange your displays. For example, to extend HDMI-1 and DP-1 to the right of eDP-1, run:

    xrandr --output HDMI-1 --auto --right-of eDP-1
    xrandr --output DP-1 --auto --right-of HDMI-1
    

    Replace the display names and positions with your desired layout. This step ensures your displays are correctly configured before Compton starts.

  3. Edit the Compton Configuration File
    Compton’s main configuration file is typically located at ~/.config/compton.conf (create it if it doesn’t exist). Open the file with a text editor (e.g., nano):

    mkdir -p ~/.config
    nano ~/.config/compton.conf
    

    Add or modify the following options to support multi-monitor setups:

    • Specify the Backend: Use glx for hardware acceleration (recommended for better performance with multiple monitors):
      backend = "glx";
          
      
    • Enable Xinerama Support: If you’re using X11, ensure disable-xinerama is set to false (this allows Compton to recognize multiple displays):
      disable-xinerama = false;
          
      
    • Configure Per-Monitor Rules (Optional): If you want to apply specific settings to certain monitors (e.g., disable shadows on an external display), use the xrandr-output directive. For example, to apply settings to HDMI-1 and DP-1 (linked to eDP-1), add:
      xrandr-output "HDMI-1" "eDP-1";
          
      xrandr-output "DP-1" "HDMI-1";
          
      
      This tells Compton to treat HDMI-1 as an extension of eDP-1 and DP-1 as an extension of HDMI-1.
  4. Start Compton with the New Configuration
    After saving the configuration file, start Compton with the -c flag to specify the config path:

    compton -c ~/.config/compton.conf
    

    If Compton is already running, kill the existing process first:

    killall compton
    compton -c ~/.config/compton.conf
    

Setting Up Compton to Start at Boot
To ensure Compton launches automatically after a reboot, create a systemd service:

  1. Create a new service file:
    sudo nano /etc/systemd/system/compton.service
    
  2. Add the following content (replace ~/.config/compton.conf with your actual config path if different):
    [Unit]
    Description=Compton Window Composer
    After=display-manager.service
    
    [Service]
    ExecStart=/usr/bin/compton -c ~/.config/compton.conf
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    
  3. Enable and start the service:
    sudo systemctl daemon-reload
    sudo systemctl enable compton.service
    sudo systemctl start compton.service
    
    Verify the service status with systemctl status compton.service—it should show as “active (running)”.

Troubleshooting Common Issues

  • Displays Not Recognized: Ensure xrandr is configured correctly before starting Compton. Run xrandr --query to verify your display layout.
  • Performance Issues: If Compton slows down with multiple monitors, try disabling shadows (shadow = false; ) or using a lighter backend (e.g., xrender instead of glx).
  • Configuration Errors: Check the Compton log for errors (run compton -c ~/.config/compton.conf --log-level debug) and adjust the config file accordingly.

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


若转载请注明出处: Compton在Debian上的多显示器设置
本文地址: https://pptw.com/jishu/733080.html
Debian中Compton的性能调优技巧 如何调整Compton在Debian上的刷新率

游客 回复需填写必要信息