Linux 进入桌面环境后自动运行程序

写一个桌面配置文件,格式大概如下:
[Desktop Entry]
Type=Application
Name=xcompmgr # 文件名字
Comment=Start xcompmgr compositor #注释
NoDisplay=true
Exec=sh -c "xcompmgr -c -C -t-10 -l-10 -r10" # 要运行的命令,也可以另写一个脚本运行
进入这个文件夹 /etc/xdg/autostart,
将上面写的文件拷贝到这个文件夹,现在你可以退出桌面环境
sudo init 3
再重进看看效果了
sudo init 5