在Linux虛擬機中配置Compton窗口合成器,可以按照以下步驟進行:
更新系統軟件包列表:
sudo apt update
安裝Compton: 根據你的Linux發行版,使用相應的包管理器進行安裝。例如,在基于Debian的系統(如Ubuntu)上:
sudo apt install compton
在基于Arch的系統上:
sudo pacman -S compton
找到配置文件:
Compton的配置文件通常位于~/.config/compton.conf
。如果該文件不存在,你可以手動創建它。
編輯配置文件:
使用文本編輯器(如nano
或vim
)打開配置文件:
nano ~/.config/compton.conf
基本配置示例: 以下是一個基本的Compton配置示例,適用于多顯示器設置:
# Compton configuration file
# Enable or disable compositing
enable = true
# Backend to use (xrender, glx, xwayland)
backend = "glx"
# Shadow properties
shadow-exclude = [
"class_g = 'Compton'",
"class_g = 'Firefox'",
"class_g = 'Thunderbird'"
]
# Output device
output = "eDP-1"
# Input devices
input-devices = [
"eDP-1",
"pointer:Logitech USB Receiver"
]
# Refresh rate
refresh-rate = 60
# Additional options
shader = "none"
enable
:啟用或禁用Compton。backend
:選擇使用的后端(例如glx
、xrender
、xwayland
)。shadow-exclude
:排除某些窗口不顯示陰影。output
:指定輸出設備。input-devices
:指定要監視的輸入設備。refresh-rate
:設置刷新率。shader
:選擇陰影效果。啟動Compton: 配置完成后,你可以通過以下命令啟動Compton:
compton -c ~/.config/compton.conf
如果你希望Compton在系統啟動時自動運行,可以將其添加到你的啟動腳本中。例如,在基于systemd的系統上,你可以創建一個服務單元文件:
sudo nano /etc/systemd/system/compton.service
添加以下內容:
[Unit]
Description=Compton Compositor
After=display-manager.service
[Service]
ExecStart=/usr/bin/compton -c ~/.config/compton.conf
Restart=always
[Install]
WantedBy=multi-user.target
然后啟用并啟動服務:
sudo systemctl enable compton
sudo systemctl start compton
通過以上步驟,你應該能夠在Linux虛擬機中成功配置Compton并為其指定輸入設備。如果有任何問題,請檢查配置文件的語法和選項是否正確,并確保你的系統支持Compton所需的所有依賴項。