当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 5 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : xinitrc---多个窗口管理器
帖子发表于 : 2009-10-27 16:26 

注册: 2008-11-13 16:03
帖子: 817
送出感谢: 0 次
接收感谢: 0 次
Switching Between Window Managers and Desktop Environments
18-Feb-2001
Stefan Jeglinski

Linux distributions typically include desktop environments like KDE and/or Gnome, and window managers like Afterstep, Blackbox, Ice, and/or WindowMaker. Each distribution sets a default, and each environment or manager has its advocates and detractors. Desktop environments like Gnome and KDE are generally slower than lean window managers like Blackbox or Ice.

* the key is .xinitrc
* the original R4 page
* return to the home page

the key is .xinitrc

* The ~/.xinitrc file is run at the X startup. If no ~/.xinitrc file exists (typically true after the initial Linux install), a default version (/etc/X11/xinit/xinitrc) is run. ~/.xinitrc commonly calls ~/.Xclients as part of the process but this is not inherently required and appears to be convention more than anything. ~/.xinitrc can exist without ~/.Xclients but not the other way around. ~/.xinitrc can be easily configured to select between desktop environments, or a variety of window managers as follows:


#!/bin/sh

########################################################################
# .xinitrc #
# 5/22/00 Stefan Jeglinski, jeglin@rapierbit.org #
# based on one written by hollis+@andrew.cmu.edu 1/5/99 #
# Thanks Hollis! #
# #
# To use: #
# * if you have a ~/.Xclients, remove it. The system copy is in #
# /etc/X11/xinit/Xclients if you ever want it back. #
# #
# * place this file in your home (~) directory. For root, #
# home is /root. #
# #
# * Type 'startx after', 'startx kde', etc. #
# #
########################################################################

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
xclients=$HOME/.Xclients
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi

if [ -f $userresources ]; then
xrdb -merge $userresources
fi

if [ -f $usermodmap ]; then
xmodmap $usermodmap
fi

########################################################################
# #
# to fix backspace and delete in X if necessary; #
# these may need to be removed for XFree86 4.x #
# #
########################################################################
xmodmap -e "keycode 59 = BackSpace"
xmodmap -e "keycode 125 = Delete"

########################################################################
# #
# accelerate the mouse in the window manager; #
# Gnome and KDE typically override this #
# #
########################################################################
xset m 8 3

########################################################################
# #
# define mouse button usage in the window manager; #
# this directive may be "eaten" by the Gnome or KDE startup #
# and may therefore need to be run again after the environment #
# is started #
# #
########################################################################
xmodmap -e "pointer = 2 1 3"

########################################################################
# #
# * Set variables for different window managers and environments #
# #
# * $1 represents the first argument to startx. #
# #
# * WM is the name of the program to execute. This is normally the #
# window manager itself, but in the case of kde or gnome it needs #
# to be the gnome-session or startkde script. #
# #
########################################################################

ARG=$1

# specify the default argument here:
DEFAULTWM="gnome-session"

if [ ! $ARG ]; then
ARG=$DEFAULTWM
fi

########################################################################
# #
# The difference between a desktop environment and a window manager #
# is that an environment provides a desktop, while a window manager #
# just handles the window dressing. An environment needs a WM, but #
# not vice versa. The only 2 environments are Gnome and KDE. Common #
# window managers for Gnome are Sawfish and Enlightenment. KDE #
# has its own window manager (kwm). #
# #
########################################################################

# to add another wm/environment here, just copy, paste,
# and edit the 'elif' line:

if [ $ARG = "gnome" ]; then
WM=gnome-session
elif [ $ARG = "kde" ]; then
WM=startkde
elif [ $ARG = "after" ]; then
WM=afterstep
elif [ $ARG = "wm" ]; then
WM=wmaker
elif [ $ARG = "en" ]; then
WM=enlightenment
elif [ $ARG = "bb" ]; then
WM=blackbox
elif [ $ARG = "ice" ]; then
WM=icewm
else
WM=$DEFAULTWM
fi

########################################################################
# #
# set a background window color for window managers only; #
# if an environment starts up, it will override this #
# #
########################################################################
xsetroot -solid MidnightBlue

########################################################################
# #
# don't turn on screen-saver for window manager #
# #
########################################################################
#xset s on

########################################################################
# #
# turn on a REAL screensaver, http://www.jwz.org/xscreensaver/ #
# #
########################################################################
xhost +localhost
xscreensaver &
xscreensaver-command -activate

########################################################################
# #
# The next line actually runs the selected window manager and logs #
# the output (stdout AND stderr) to the file ~/console. If you run a #
# #
# tail -f ~/console #
# #
# in an xterm, it will display the (constantly updated) contents of #
# that file. This can be usful for talk requests, wm errors, etc. #
# #
########################################################################

exec $WM >& ~/console


* With this .xinitrc, from bash, just run startx gnome, startx kde, startx after, etc. If a mistake is made in typing, Gnome will be launched because it's the default. Make sure of course that the window manager or environment you are trying to run is installed!

* If you are running XFree86, check out the XFree86 page for more information. If you are running Xpmac, arguments can be passed to set monitor resolution. These arguments cannot be passed in .xinitrc, but they can easily be added as an alias; to do this, add the following example aliases to .bashrc:


alias sa='startx after -- -mode 16 -depth 16'
alias sk='startx kde -- -mode 16 -depth 16'
alias sg='startx -- -mode 16 -depth 16'


then just type sa, sk, or sg from the command line.

* A desktop environment (for example, startkde) cannot be launched directly from the console, because the X server will not have been launched. The instructions in .xinitrc are only run after the X server starts, and for that startx must be used to begin the process.


原文地址:http://www.rapierbit.org/linux/winmgrs.html


_________________
HP ProBook4321s,I3+ATI
OS : Fedora + Debian

http://box-look.org/


页首
 用户资料  
 
2 楼 
 文章标题 : Re: xinitrc---多个窗口管理器
帖子发表于 : 2009-10-27 17:38 
头像

注册: 2009-10-16 22:46
帖子: 18958
地址: finland
送出感谢: 28
接收感谢: 48
晕,没汉字 :em20


_________________
>>>>推Ubuntu 桌面培训~~<<<<
>>>>想加入/了解gimp汉化吗,点我吧~<<<<
——————————————————————
不推荐wubi,也不推荐你给别人推荐wubi…………
随心而为的感觉真好……
强推mayhem!!
强推ensiferum


页首
 用户资料  
 
3 楼 
 文章标题 : Re: xinitrc---多个窗口管理器
帖子发表于 : 2009-10-27 18:31 
头像

注册: 2008-04-26 12:41
帖子: 10971
送出感谢: 11
接收感谢: 38
:em20


_________________
[新手必读]wubi安装常见问题(FAQ)
[分享]装双系统的同学必看——Windows与Linux系统共享交换分区的方法
kde下唯美的暗黑内透主题(无需编译)
无穷老机上的Trinity Desktop Environment


页首
 用户资料  
 
4 楼 
 文章标题 : Re: xinitrc---多个窗口管理器
帖子发表于 : 2009-10-27 19:46 
头像

注册: 2005-08-14 21:55
帖子: 58428
地址: 长沙
送出感谢: 4
接收感谢: 272
这,确实是折腾了。 :em04


_________________
● 鸣学


页首
 用户资料  
 
5 楼 
 文章标题 : Re: xinitrc---多个窗口管理器
帖子发表于 : 2009-10-27 20:27 

注册: 2008-11-13 16:03
帖子: 817
送出感谢: 0 次
接收感谢: 0 次
nmsfan 写道:
晕,没汉字 :em20



脚本要汉字干砸

不折疼的话,就没必要了,要折腾的话,没汉字也明白的


_________________
HP ProBook4321s,I3+ATI
OS : Fedora + Debian

http://box-look.org/


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 5 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 4 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译