xprofile
外观
xprofile 文件(~/.xprofile 和 /etc/xprofile)允许你在 X 用户会话开始时——在窗口管理器启动之前——执行命令。
xprofile 文件的风格与 xinitrc 类似。
兼容性
以下显示管理器原生支持加载 xprofile 文件:
- GDM -
/etc/gdm/Xsession - LightDM -
/etc/lightdm/Xsession - LXDM -
/etc/lxdm/Xsession - SDDM -
/usr/share/sddm/scripts/Xsession
在通过 xinit 启动的会话中加载 xprofile
可以通过以下程序启动的会话来加载 xprofile:
所有这些管理器都会直接或间接地执行 ~/.xinitrc,如果该文件不存在,则执行 /etc/X11/xinit/xinitrc。这就是为什么 xprofile 必须从这些文件中加载的原因。
~/.xinitrc and /etc/X11/xinit/xinitrc
#!/bin/sh # Make sure this is before the 'exec' command or it won't be sourced. [ -f /etc/xprofile ] && . /etc/xprofile [ -f ~/.xprofile ] && . ~/.xprofile ...
配置
首先,如果 ~/.xprofile 文件尚不存在,请创建它。然后,只需添加你希望随会话启动的程序命令。详见下文
~/.xprofile
tint2 & nm-applet &