xprofile
xprofile 文件,~/.xprofile
以及 /etc/xprofile
, 允許您在剛打開 X 會話時運行命令 - 在窗口管理器運行之前。Xprofile 用於隨會話自動運行程序,或從顯示管理器啟動,尤其是那個會話沒有自帶自動啟動程序功能時 - 比如一個獨立的窗口管理器。
xprofile 文件在語法和概念上類似 xinitrc, ~/.xinitrc
和 /etc/X11/xinit/xinitrc.d/
.
兼容性[編輯 | 編輯原始碼]
xprofile 和 xinitrc 文件在原生情況下會被以下顯示管理器引用:
- GDM -
/etc/gdm/Xsession
- LightDM -
/etc/lightdm/Xsession
- LXDM -
/etc/lxdm/Xsession
- SDDM -
/usr/share/sddm/scripts/Xsession
在用 init 開啟會話之時引用 xprofile[編輯 | 編輯原始碼]
使用以下程序啟動會話時能夠引用 xprofile 文件:
以上程序,都會直接或間接地執行,~/.xinitrc
(如果不存在的話,通常是複製自 /etc/skel/.xinitrc
) 或 /etc/X11/xinit/xinitrc
. 這就是我們要從下列文件引用 xprofile 的原因.
~/.xinitrc 和 /etc/X11/xinit/xinitrc 和 /etc/skel/.xinitrc
#!/bin/sh # Make sure this is before the 'exec' command or it won't be sourced. [ -f /etc/xprofile ] && source /etc/xprofile [ -f ~/.xprofile ] && source ~/.xprofile ...
xinitrc.d/*
文件已經引用自默認 xinitrc 文件。
配置[編輯 | 編輯原始碼]
首先,如果文件不存在的話創建 ~/.xprofile
. 然後只需加入你想要隨會話一同啟動的程序的命令。見以下:
~/.xprofile
tint2 & nm-applet &