LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: zzhao

.xinitrc 和 .xsession 在什么情况下起作用

[复制链接]
发表于 2005-5-18 13:28:20 | 显示全部楼层
Debian 是不需要 .xinitrc  .xsession  的

尽可以删掉

输入法启动这些可以写在 /etc/X11/Xsession.d/ 下面

比如我的输入法启动就是在
/etc/X11/Xsession.d/95im-launch
里写入
export XMODIFIERS=@im=SCIM
fcitx
回复 支持 反对

使用道具 举报

发表于 2005-5-18 14:53:18 | 显示全部楼层
Xsession.d这个目录下,除了99*****那个文件是启动时不执行的,其他的是按照字母排列在启动x的时候执行的。
如果你想自己增加,只要添加一个文件就行了。就像huahua那样。名字可以自己取。
你可以把全局变量,输入法,screensaver之类的东西都放在这里。
回复 支持 反对

使用道具 举报

发表于 2005-5-18 14:54:15 | 显示全部楼层
:beat huahua你写错了。
回复 支持 反对

使用道具 举报

发表于 2005-5-18 14:54:53 | 显示全部楼层
:beat huahua你写错了。
export XMODIFIERS=@im=SCIM
                                         ^^^^^
fcitx
^^^^^
回复 支持 反对

使用道具 举报

发表于 2005-5-18 15:01:23 | 显示全部楼层
Post by jhuangjiahua
Debian 是不需要 .xinitrc  .xsession  的

尽可以删掉

输入法启动这些可以写在 /etc/X11/Xsession.d/ 下面

比如我的输入法启动就是在
/etc/X11/Xsession.d/95im-launch
里写入
export XMODIFIERS=@im=SCIM
fcitx


恰恰相反,我更喜欢将输入法及其它环境变量写在.xsession中。

我的经验,如果使用startx启动系统,那么.xinitrc同.xsession的作用几乎是一样的;但是,如果你使用gdm等,gdm是不会去读取.xinitrc中的内容的,但是如果有.xsession,它是会读取.xsession中的内容的。

所以,为了保持系统启动后的设置统一,建议你移除.xinitrc,只留下.xsession就可以了。这样的话,无论你是使用startx,还是使用gdm,你都会得到同样的X。

楼上有兄弟说,
如果你用xdm, gdm.kdm 之类的时候.xinitrc, .xsession不起作用
,这种说法是不准确的。.xsession是会起作用的。

这是我的.xsession文件
LANGUAGE = zh_CN.UTF-8
LANG = zh_CN.UTF-8
LC_ALL = zh_CN.UTF-8
export LANGUAGE LANG LC_ALL
export G_BROKEN_FILENAMES=1
export GST_ID3_TAG_ENCODING=GBK
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE="fcitx"
fcitx &
exec xscreensaver -no-splash &
exec xfce4-session
回复 支持 反对

使用道具 举报

发表于 2005-5-18 16:23:38 | 显示全部楼层
ainxtein:
1. 是数字顺序,
2. 没有错 , fcitx 不依赖特定的 XMODIFIERS
只要有个 XMODIFIERS=@im=XXXX 就可以了


肯定来过:
错,
只有把 GDM 会话类型设置为 “自定义” ,  GDM 才会读 .xsession 的

在 GDM 会话类型里选具体的会话类型 ( 比如选 XFCE ), 她是不会读 .xsession 的


你自己想, 如果会话类型都选了 Gnome , 但是她还去读  .xsession 的话,由于 你的  .xsession 里写了 XFCE 的启动 , 那 还会开 Gnome 么 ???


所以不建议用  .xsession
回复 支持 反对

使用道具 举报

发表于 2005-5-18 17:16:40 | 显示全部楼层
对,我用GDM,所有配置都放在 ~/.xsession 中,所以这个文件是有作用的。
但最近发现,还有个文件,需要配置,而且优先级比~/.xsession高,这个文件就是 ~/.dmrc ,这个文件保存的就是通过GDM登陆,而作的默认选择,比如选择语言 Simplied Chinese,选择 Gnome 作为默认桌面管理器。
回复 支持 反对

使用道具 举报

发表于 2005-5-18 18:00:33 | 显示全部楼层
先看man startx中的一段:

Note that in the Debian system, what many people traditionally put in the .xinitrc file should go in .xsession instead; this permits the same X environment to be presented whether startx, xdm, or xinit is used to start the X session. All discussion of the .xinitrcfile in the xinit manual page applies equally well to .xsession. Keep in mind that .xinitrc is used only by xinit and completely ignored by xdm.


很显然,.xsession在debian中已经取代了.xinitrc,可以为startx、xdm以及xinit启动的X提供统一的环境。.xinitrc才会被xdm忽略。


再来看man xdm,其中有一段:

After the user logs in, xdm runs the Xstartup script as root.

Then xdm runs the Xsession script as the user. This system session file may do some additional startup and typically runs the .xsession script in the user's home directory. When the Xsession script exits, the session is over.

很明显,xdm是会读取用户目录的.xsession的。

所以,

Post by jhuangjiahua
ainxtein:
所以不建议用  .xsession


是不对的,.xsession可以为startx、xdm以及xinit启动的X提供统一的环境,一举多得,为什么不用?比单独设置xdm或gdm好多了。

至于

Post by jhuangjiahua
ainxtein:

你自己想, 如果会话类型都选了 Gnome , 但是她还去读  .xsession 的话,由于 你的  .xsession 里写了 XFCE 的启动 , 那 还会开 Gnome 么 ???



我自己是只使用一种桌面环境的,如果想同时使用多种桌面环境,只需要把.xsession中的

exec xfce4-session

去掉就可以了嘛
回复 支持 反对

使用道具 举报

发表于 2005-5-18 19:06:35 | 显示全部楼层
学到不少东西,关注一下!
回复 支持 反对

使用道具 举报

发表于 2005-5-18 19:14:20 | 显示全部楼层
Post by 肯定来过
先看man startx中的一段:

Note that in the Debian system, what many people traditionally put in the .xinitrc file should go in .xsession instead; this permits the same X environment to be presented whether startx, xdm, or xinit is used to start the X session. All discussion of the .xinitrcfile in the xinit manual page applies equally well to .xsession. Keep in mind that .xinitrc is used only by xinit and completely ignored by xdm.

Ha...Ha...

I use .xinitrc and I only start my X with

xinit /usr/bin/hackedbox
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表