Compton在Debian上的多显示器设置
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:
-
Verify Display Configuration with
xrandr
Runxrandr --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 ofeDP-1
), andDP-1
(right ofHDMI-1
). -
Set Up Displays with
xrandr
Usexrandr
commands to arrange your displays. For example, to extendHDMI-1
andDP-1
to the right ofeDP-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.
-
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 tofalse
(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 toHDMI-1
andDP-1
(linked toeDP-1
), add:
This tells Compton to treatxrandr-output "HDMI-1" "eDP-1"; xrandr-output "DP-1" "HDMI-1";
HDMI-1
as an extension ofeDP-1
andDP-1
as an extension ofHDMI-1
.
- Specify the Backend: Use
-
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:
- Create a new service file:
sudo nano /etc/systemd/system/compton.service
- 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
- Enable and start the service:
Verify the service status withsudo systemctl daemon-reload sudo systemctl enable compton.service sudo systemctl start compton.service
systemctl status compton.service
—it should show as “active (running)”.
Troubleshooting Common Issues
- Displays Not Recognized: Ensure
xrandr
is configured correctly before starting Compton. Runxrandr --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 ofglx
). - 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