Compton是一个轻量级的X11合成窗口管理器,可以提供窗口透明、阴影、淡入淡出等视觉效果。以下是在Linux系统中启用Compton的步骤:
sudo apt install compton
sudo pacman -S compton
sudo dnf install compton
compton -b
-b
参数表示在后台运行
编辑~/.xinitrc
文件,在启动窗口管理器/桌面环境之前添加:
compton -b &
compton -b
mkdir -p ~/.config/systemd/user/
nano ~/.config/systemd/user/compton.service
[Unit]
Description=Compton compositor
After=display-manager.service
[Service]
ExecStart=/usr/bin/compton -b
Restart=always
RestartSec=3
[Install]
WantedBy=default.target
systemctl --user enable compton.service
systemctl --user start compton.service
nano ~/.config/compton.conf
# 阴影效果
shadow = true;
no-dock-shadow = true;
no-dnd-shadow = true;
clear-shadow = true;
shadow-radius = 7;
shadow-offset-x = -7;
shadow-offset-y = -7;
shadow-opacity = 0.7;
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g ?= 'Notify-osd'",
"class_g = 'Cairo-clock'",
"_GTK_FRAME_EXTENTS@:c"
];
# 淡入淡出效果
fading = true;
fade-delta = 4;
fade-in-step = 0.03;
fade-out-step = 0.03;
fade-exclude = [ ];
# 透明度
inactive-opacity = 0.8;
frame-opacity = 0.7;
inactive-opacity-override = false;
active-opacity = 1.0;
# 其他选项
backend = "glx";
vsync = true;
mark-wmwin-focused = true;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
refresh-rate = 0;
use-ewmh-active-win = true;
unredir-if-possible = true;
focus-exclude = [ "class_g = 'Cairo-clock'" ];
detect-transient = true;
detect-client-leader = true;
使用配置文件启动:
compton --config ~/.config/compton.conf -b
黑屏或闪烁问题:
--backend glx
或 --backend xrender
--vsync false
性能问题:
检查是否运行:
pgrep compton
停止Compton:
pkill compton
针对NVIDIA显卡用户可能需要添加:
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
针对Intel显卡用户:
backend = "xrender";
通过以上步骤,你应该能够成功在Linux系统中启用并配置Compton合成器,获得更好的视觉效果。