在 Linux 中让 compton(现在很多发行版叫 picom)开机启动,取决于你使用的桌面环境 / 显示管理器 / 启动方式。下面按常见情况说明。
一般都有“启动应用程序”的功能。
Comptoncompton 或 compton --config ~/.config/compton.conf如果是 picom:命令写
picom
适用于大多数桌面环境(XFCE、LXDE、KDE、GNOME)
mkdir -p ~/.config/autostart
创建文件:
~/.config/autostart/compton.desktop
内容:
[Desktop Entry]
Type=Application
Name=Compton
Exec=compton --config ~/.config/compton.conf
NoDisplay=false
X-GNOME-Autostart-enabled=true
如果使用 picom:
Exec=picom --config ~/.config/picom.conf
在 ~/.config/i3/config 里加:
exec --no-startup-id compton
或:
exec --no-startup-id picom
在 ~/.config/bspwm/bspwmrc:
compton &
或:
picom &
mkdir -p ~/.config/systemd/user
创建:
~/.config/systemd/user/compton.service
内容:
[Unit]
Description=Compton compositor
After=graphical.target
[Service]
ExecStart=/usr/bin/compton --config %h/.config/compton.conf
Restart=on-failure
[Install]
WantedBy=default.target
启用:
systemctl --user enable compton
systemctl --user start compton
可加延迟:
Exec=sleep 2 && compton
ps aux | grep compton
comptonpicom如果你告诉我:
我可以给你最准确的一条命令。