Compton在CentOS上的使用教程

Compton是一款轻量级的窗口管理器,能够提升Linux桌面的视觉效果和性能。以下是在CentOS上安装和配置Compton的详细步骤:

安装Compton

  1. 更新系统包列表
sudo yum update -y
  1. 安装Compton
sudo yum install -y compton

或者,如果你使用的是较新的CentOS版本,可能会使用 dnf

sudo dnf install compton

配置Compton

  1. 创建或编辑配置文件
    Compton的配置文件通常位于 /.config/compton.conf。你可以手动创建这个文件,或者使用默认配置并进行修改。
mkdir -p /.config/compton.conf
  1. 基本配置示例
    以下是一个基本的Compton配置示例,适用于多显示器设置:
backend  "glx" ;
shadow-exclude  [ ".*" , "[class'.*Firefox']" , "[title'.*Firefox']" ] ;
alpha-mode  "none" ;
alpha-ignores  [ ".*" , "[class'.*Firefox']" , "[title'.*Firefox']" ] ;
glx-no-stencil  true ;
glx-copy-from-front  true ;
shader-file  null ;
shader-frag  null ;
shader-vert  null ;
xrandr-args  "" ;

配置多显示器

确保你的显示器已经通过 xrandr 正确配置。你可以使用以下命令查看当前的显示器配置:

xrandr --query

假设你有三个显示器,分别是 HDMI-1, DP-1, 和 eDP-1,你可以使用以下命令将它们配置为扩展模式:

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

启动Compton

你可以通过以下命令启动Compton:

compton -c /.config/compton.conf

设置Compton开机自启动

为了确保Compton在系统启动时自动运行,你可以创建一个 systemd 服务。

  1. 创建 systemd 服务文件
sudo nano /etc/systemd/system/compton.service
  1. 添加以下内容到服务文件
[Unit]
Description=Compton Compositor
After=display-manager.service

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

[Install]
WantedBy=multi-user.target
  1. 启用并启动服务
sudo systemctl enable compton.service
sudo systemctl start compton.service

验证配置

确保Compton正在运行并且多显示器配置正确。你可以通过以下命令检查Compton的状态:

systemctl status compton.service

如果一切正常,你应该能够看到Compton正在运行,并且你的多显示器设置应该已经生效。

通过以上步骤,你应该能够在CentOS中成功配置Compton以支持多显示器。如果有任何问题,请检查日志文件或参考Compton的官方文档。

Both comments and pings are currently closed.

Comments are closed.

Powered by KingAbc | 粤ICP备16106647号-2 | Loading Time‌ 0.238