在Debian上安裝和配置Compton的最佳實踐包括以下步驟:
sudo apt update
sudo apt install compton
創建或編輯配置文件:
~/.config/compton.conf
。如果該文件不存在,可以手動創建。nano
:nano ~/.config/compton.conf
# 啟用陰影
shadow-exclude { "class_g 'GtkWindow'", "class_g 'GtkDialog'", "instance 'true'" }
# 設置陰影模糊半徑
shadow-radius 2
# 設置陰影偏移量
shadow-dx 2
shadow-dy 2
# 設置透明度模式
transparency false
# 設置后臺顏色
background "#000000"
# 設置合成器
backend "xwayland" # 或者 "glx" 取決于你的系統
設置Compton啟動腳本(可選):
/etc/init.d/
目錄下創建一個名為compton
的文件,并添加以下內容:#!/bin/sh
### BEGIN INIT INFO
# Provides: compton
# Required-Start: local_fs remote_fs network syslog named time uids groups
# Required-Stop: local_fs remote_fs network syslog named time uids groups
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Compton window manager
### END INIT INFO
case "$1" in
start)
compton --config ~/.config/compton.conf &
;;
stop)
pkill compton
;;
restart)
pkill compton
compton --config ~/.config/compton.conf &
;;
*)
echo "Usage: /etc/init.d/compton {startstoprestart}"
exit 1
;;
esac
exit 0
sudo chmod +x /etc/init.d/compton
sudo systemctl enable compton
sudo systemctl start compton
禁用不必要特效:
backend
設置為glx
或wayland
(而非xrender
)。啟用GPU加速:
backend glx
以啟用GPU加速。限制資源使用:
systemd
或cpulimit
等工具限制Compton的資源占用,例如將CPU使用率限制在50%:sudo cpulimit -l 50 -p compton/compton
使用預配置方案:
通過以上步驟,您可以在Debian系統上成功安裝、配置和優化Compton,以獲得最佳的桌面性能和視覺效果。