溫馨提示×

Compton在CentOS中的配置步驟

小樊
32
2025-08-24 23:46:08
欄目: 智能運維

以下是在CentOS中配置Compton的步驟:

  1. 安裝Compton

    • 啟用EPEL倉庫(若未啟用):
      sudo yum install epel-release
      
    • 安裝Compton:
      sudo yum install compton  # CentOS 7及以下
      sudo dnf install compton  # CentOS 8及以上
      
  2. 創建配置文件

    • 若默認路徑/.config/compton.conf不存在,手動創建:
      mkdir -p /.config
      nano /.config/compton.conf
      
    • 示例配置(關鍵參數說明):
      backend = "glx"       # 選擇后端(glx/wayland,推薦glx提升性能)
      shadow = true         # 啟用陰影
      shadow-exclude = [".*"] # 排除窗口陰影(如桌面環境窗口)
      opacity = 0.9         # 窗口透明度(0.0-1.0)
      vsync = true          # 啟用垂直同步
      
  3. 啟動Compton

    • 手動啟動:
      compton --config /.config/compton.conf &
      
    • 設置開機自啟:
      sudo nano /etc/systemd/system/compton.service
      
      添加以下內容:
      [Unit]
      Description=Compton Compositor
      After=graphical.target
      
      [Service]
      ExecStart=/usr/bin/compton --config /.config/compton.conf
      Restart=on-failure
      
      [Install]
      WantedBy=graphical.target
      
      然后執行:
      sudo systemctl enable compton
      sudo systemctl start compton
      
  4. 驗證與優化

    • 檢查日志(默認輸出到終端,可配置log-file參數輸出到文件):
      journalctl -u compton -f
      
    • 調整性能:關閉陰影/透明度、啟用GPU加速(backend=glx)或限制CPU占用(cpulimit -l 50 -p $(pgrep compton))。

注意:CentOS默認使用X11,若需Wayland支持需額外配置顯示服務器。

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女