slim的问题,大三八快来

其他Linux/Unix/BSD/OSX等发行版讨论
回复
头像
jarryson
帖子: 4002
注册时间: 2005-08-14 19:53

Re: slim的问题,大三八快来

#2

帖子 jarryson » 2009-12-05 13:40

如果是通过~/.xinitrc,就添加一行LANG=zh_CN.UTF-8
头像
leeaman
帖子: 30702
注册时间: 2007-02-02 18:14
系统: debian sid

Re: slim的问题,大三八快来

#3

帖子 leeaman » 2009-12-05 14:01

论坛似乎有人写有脚本的,不知道是不是在大三八的那个帖子里
醉了星星,醉月亮●●●●●The Long Way To Go(*^_^*)
头像
yechao1989
帖子: 576
注册时间: 2009-07-19 21:03

Re: slim的问题,大三八快来

#4

帖子 yechao1989 » 2009-12-05 14:36

大三八还没来阿?
Man->Wiki->Google->Froum->Get it :-)
头像
萝卜兔
帖子: 481
注册时间: 2009-11-10 9:33
来自: 光驱

Re: slim的问题,大三八快来

#5

帖子 萝卜兔 » 2009-12-05 18:10

围观大三八 :em06
机箱里面有萝卜
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球

Re: slim的问题,大三八快来

#6

帖子 adagio » 2009-12-05 20:03

jarryson 写了:如果是通过~/.xinitrc,就添加一行LANG=zh_CN.UTF-8
我给jarryson补充一下,如果用slim,那就是这样

如果用aur里的slim-plus ,那就要写到~/.xprofile,或者自己改/etc/slim.conf,加上查找~/.xinitrc的语句
反正你看看/etc/slim.conf就知道了
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
头像
photor
论坛版主
帖子: 11004
注册时间: 2008-04-26 12:41

Re: slim的问题,大三八快来

#7

帖子 photor » 2009-12-05 21:55

adagio 写了:
jarryson 写了:如果是通过~/.xinitrc,就添加一行LANG=zh_CN.UTF-8
我给jarryson补充一下,如果用slim,那就是这样

如果用aur里的slim-plus ,那就要写到~/.xprofile,或者自己改/etc/slim.conf,加上查找~/.xinitrc的语句
反正你看看/etc/slim.conf就知道了
我用8.04LTS,没有slim-plus :em09
搞了一阵才知道slim不是像gdm和kdm那样自动查找/usr/share/xsessions/下面的session,不爽 :em20
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球

Re: slim的问题,大三八快来

#8

帖子 adagio » 2009-12-06 11:26

photor 写了: 我用8.04LTS,没有slim-plus :em09
搞了一阵才知道slim不是像gdm和kdm那样自动查找/usr/share/xsessions/下面的session,不爽 :em20
slim就是这样,启动脚本不好,slim-plus就可以自动查找/usr/share/xsessions
如果ubuntu没有,你只好自己编译一个了,或者干脆用startx :em04
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
头像
photor
论坛版主
帖子: 11004
注册时间: 2008-04-26 12:41

Re: slim的问题,大三八快来

#9

帖子 photor » 2009-12-06 20:18

找到了
http://aur.archlinux.org/packages.php?ID=31601
上面的Xsession.sh(话说那个维护者jarryson就是2楼吧?景仰啊),内容是这样的:

代码: 全选

#!/bin/sh

# fix broken $UID on some system...
if test "x$UID" = "x"; then
	if test -x /usr/xpg4/bin/id; then
		UID=`/usr/xpg4/bin/id -u`;
	else
		UID=`id -u`;
	fi
fi

if test "x$XDG_CONFIG_HOME" = "x" ; then
  XDG_CONFIG_HOME=$XDG_CONFIG_HOME/.config
fi
[ -d "$XDG_CONFIG_HOME" ] || mkdir "$XDG_CONFIG_HOME"
if test "x$XDG_CACHE_HOME" = "x" ; then
  XDG_CACHE_HOME=$XDG_CONFIG_HOME/.cache
fi
[ -d "$XDG_CACHE_HOME" ] || mkdir "$XDG_CACHE_HOME"

if [ -e $HOME/.xsession-errors.0 ] && [ -e $HOME/.xsession-errors ]; then
	rm $HOME/.xsession-errors.0
	mv $HOME/.xsession-errors $HOME/.xsession-errors.0
elif [ ! -e $HOME/.xsession-errors.0 ] && [ -e $HOME/.xsession-errors ]; then
	mv $HOME/.xsession-errors $HOME/.xsession-errors.0
fi

for errfile in "$HOME/.xsession-errors" "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
do
	if ( cp /dev/null "$errfile" 2> /dev/null ) ; then
		chmod 600 "$errfile"
		exec > "$errfile" 2>&1
		break
	fi
done

echo "$0: Beginning session setup..."

userresources="$HOME/.Xresources"
usermodmap="$HOME/.Xmodmap"
userxkbmap="$HOME/.Xkbmap"

sysresources=/usr/lib/X11/xinit/.Xresources
sysmodmap=/usr/lib/X11/xinit/.Xmodmap
sysxkbmap=/etc/X11/Xkbmap

rh6sysresources=/etc/X11/xinit/Xresources 
rh6sysmodmap=/etc/X11/xinit/Xmodmap 

# merge in defaults
if [ -f "$rh6sysresources" ]; then xrdb -merge "$rh6sysresources"; fi
if [ -f "$sysresources" ]; then xrdb -merge "$sysresources"; fi
if [ -f "$userresources" ]; then xrdb -merge "$userresources"; fi

# merge in keymaps
if [ -f "$sysxkbmap" ]; then
    setxkbmap `cat "$sysxkbmap"`
    XKB_IN_USE=yes
fi

if [ -f "$userxkbmap" ]; then
    setxkbmap `cat "$userxkbmap"`
    XKB_IN_USE=yes
fi

if [ -z "$XKB_IN_USE" -a ! -L /etc/X11/X ]; then
    if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then
       xkbsymbols=`sed -n -e 's/^[     ]*XkbSymbols[   ]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config`
       if [ -n "$xkbsymbols" ]; then
           setxkbmap -symbols "$xkbsymbols"
           XKB_IN_USE=yes
       fi
    fi
fi

# xkb and xmodmap don't play nice together
if [ -z "$XKB_IN_USE" ]; then
    if [ -f "$rh6sysmodmap" ]; then
       xmodmap "$rh6sysmodmap"
    fi
    if [ -f "$sysmodmap" ]; then
       xmodmap "$sysmodmap"
    fi
    if [ -f "$usermodmap" ]; then
       xmodmap "$usermodmap"
    fi
fi

unset XKB_IN_USE

# run all system xinitrc shell scripts.
if [ -d /etc/X11/xinit/xinitrc.d ]; then
    for i in /etc/X11/xinit/xinitrc.d/* ; do
        if [ -x "$i" ]; then
	    . "$i"
        fi
    done
fi
SESSIONS="/usr/share/xsessions"
Session=xfce		#Default set to xfce
dmrc=/var/state/dm/dmrc
userdmrc=$HOME/.dmrc

if [ -e $dmrc ]; then
	localecmd="$(grep "LANG=" $dmrc 2>/dev/null)"
	keymapcmd="$(grep "loadkeys" $dmrc 2>/dev/null)"
	xkbmapcmd="$(grep "setxkbmap" $dmrc 2>/dev/null)"
	if [ "$localecmd" ]; then 
		if [ "$(grep "LANG=" $userdmrc 2>/dev/null)" ] ; then
			sed -i "s@^.*LANG=.*@$localecmd@" $userdmrc 
		else
			echo "$localecmd" >> $userdmrc
		fi
	fi
	if [ "$keymapcmd" ]; then 
		if [ "$(grep "loadkeys" $userdmrc 2>/dev/null)" ]; then
			sed -i "s@^.*loadkeys.*@$keymapcmd@" $userdmrc 
		else
			echo "$keymapcmd" >> $userdmrc
		fi		
	fi
	if [ "$xkbmapcmd" ]; then 
		if [ "$(grep "setxkbmap" $userdmrc 2>/dev/null)" ]; then
			sed -i "s@^.*setxkbmap.*@$xkbmapcmd@" $userdmrc
		else
			echo "$xkbmapcmd" >> $userdmrc
		fi
	fi
	
	rm -f $dmrc
fi
if [ -e "$userdmrc" ]; then
	source $userdmrc 1> /dev/null 2> /dev/null
	[ "Language" ] && export LANG="$Language"
	export LC_COLLATE="$LANG"
else 
	echo "[Desktop]" >> "$userdmrc"
	echo "Session=" >> "$userdmrc"
	echo "Language=" >> "$userdmrc"
fi

# accept $SESSION and remember Session

if [ "$1" ];then
	Session="$1"
	sed -i "s@^.*Session=.*@Session=$1@" $userdmrc
	if [ ! "$(grep "Session=" $userdmrc 2>/dev/null)" ] ; then
		echo "Session=$Session" >> $userdmrc
	fi
fi

echo "$0: Session=$Session"

profile=/etc/profile
userprofile=$HOME/.profile

if [ -r $profile ]; then
	source $profile 1> /dev/null 2> /dev/null
fi
if [ -r $userprofile ]; then
	source $userprofile 1> /dev/null 2> /dev/null
fi

xprofile=/etc/xprofile
userxprofile=$HOME/.xprofile
if [ -r $xprofile ]; then
	source $xprofile $Session
fi
if [ -r $userxprofile ]; then
	source $userxprofile $Session
fi

echo "$0: Ready to start desktop..."
# We should normally get the session command from desktop files
if [ -e ${SESSIONS}/${Session}.desktop ];then
	COMMAND="$(sed -n 's/Exec[ \t]*=[ \t]*\(.*\)$/\1/p' ${SESSIONS}/${Session}.desktop)"
	echo "$0: Setup done, will start: ${SESSIONS}/${Session}.desktop"
	exec ck-launch-session $COMMAND
else echo "$0: Faild to find ${SESSIONS}/${Session}.desktop, try another way..."
fi

case "$Session" in
default)
	xsetroot -solid SteelBlue
	exec xterm -geometry 80x24-0-0
	;;
xfce4)
	startxfce4
	;;
kde)
	ck-launch-session  startkde
	;;
gnome)
	ck-launch-session  gnome-session
	;;
fluxbox)
	ck-launch-session  fluxbox
	;;
fvwm2)
	xsetroot -solid SteelBlue
	ck-launch-session  fvwm2
	;;
fvwm95)
	xsetroot -solid SteelBlue
	ck-launch-session  fvwm95
	;;
blackbox)
	ck-launch-session  blackbox
	;;
windowmaker)
	exec /etc/X11/xinit/xinitrc.wmaker
	;;
afterstep)
	ck-launch-session  afterstep
	;;
enlightenment)
	exec /etc/X11/xinit/xinitrc.enlightenment
	;;
twm)
	#xclock -geometry 50x50-1+1 &
	#xterm -geometry 80x50+494+51 &
	#xterm -geometry 80x20+494-0 &
	#xterm -geometry 80x66+0+0 -name login &
	xsetroot -solid SteelBlue
	ck-launch-session twm
	;;
esac

if [ -x $HOME/.xsession ]; then
        exec $HOME/.xsession $@
fi

if [ -r /etc/X11/xinit/xinitrc.xfce ]; then
	exec /etc/X11/xinit/xinitrc.xfce
fi
用它直接代替8.04LTS原来的/etc/X11/Xsession脚本:

代码: 全选

#!/bin/sh
#
# /etc/X11/Xsession
#
# global Xsession file -- used by display managers and xinit (startx)

# $Id: Xsession 967 2005-12-27 07:20:55Z dnusinow $

set -e

PROGNAME=Xsession

message () {
  # pretty-print messages of arbitrary length; use xmessage if it
  # is available and $DISPLAY is set
  MESSAGE="$PROGNAME: $*"
  echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
  if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
    echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
  fi
}

message_nonl () {
  # pretty-print messages of arbitrary length (no trailing newline); use
  # xmessage if it is available and $DISPLAY is set
  MESSAGE="$PROGNAME: $*"
  echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2;
  if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
    echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
  fi
}

errormsg () {
  # exit script with error
  message "$*"
  exit 1
}

internal_errormsg () {
  # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
  # One big call to message() for the sake of xmessage; if we had two then
  # the user would have dismissed the error we want reported before seeing the
  # request to report it.
  errormsg "$*" \
           "Please report the installed version of the \"x11-common\"" \
           "package and the complete text of this error message to" \
           "<debian-x@lists.debian.org>."
}

# initialize variables for use by all session scripts

OPTIONFILE=/etc/X11/Xsession.options

SYSRESOURCES=/etc/X11/Xresources
USRRESOURCES=$HOME/.Xresources

SYSSESSIONDIR=/etc/X11/Xsession.d
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession
ERRFILE=$HOME/.xsession-errors

# attempt to create an error file; abort if we cannot
if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] &&
  [ ! -L "$ERRFILE" ]; then
  chmod 600 "$ERRFILE"
elif ERRFILE=$(tempfile 2> /dev/null); then
  if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then
    message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
             "\"$ERRFILE\"; look for session log/errors in" \
             "\"$TMPDIR/xsession-$USER\"."
  fi
else
  errormsg "unable to create X session log/error file; aborting."
fi

# truncate ERRFILE if it is too big to avoid disk usage DoS
if [ "`stat -c%s \"$ERRFILE\"`" -gt 500000 ]; then
  T=`mktemp -p "$HOME"`
  tail -c 500000 "$ERRFILE" > "$T" && mv -f "$T" "$ERRFILE" || rm -f "$T"
fi

exec >>"$ERRFILE" 2>&1

echo "$PROGNAME: X session started for $LOGNAME at $(date)"

# sanity check; is our session script directory present?
if [ ! -d "$SYSSESSIONDIR" ]; then
  errormsg "no \"$SYSSESSIONDIR\" directory found; aborting."
fi

# Attempt to create a file of non-zero length in /tmp; a full filesystem can
# cause mysterious X session failures.  We do not use touch, :, or test -w
# because they won't actually create a file with contents.  We also let standard
# error from tempfile and echo go to the error file to aid the user in
# determining what went wrong.
WRITE_TEST=$(tempfile)
if ! echo "*" >>"$WRITE_TEST"; then
  message "warning: unable to write to ${WRITE_TEST%/*}; X session may exit" \
          "with an error"
fi
rm -f "$WRITE_TEST"

# use run-parts to source every file in the session directory; we source
# instead of executing so that the variables and functions defined above
# are available to the scripts, and so that they can pass variables to each
# other
SESSIONFILES=$(run-parts --list $SYSSESSIONDIR)
if [ -n "$SESSIONFILES" ]; then
  set +e
  for SESSIONFILE in $SESSIONFILES; do
    . $SESSIONFILE
  done
  set -e
fi

exit 0

# vim:set ai et sts=2 sw=2 tw=80:
以后,基本ok,简单修改slim.conf以后可以自由选择/usr/share/xsessions/下面的*.desktop登录,但是就有一个问题:输入法程序scim没有自动启动。何解?
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球

Re: slim的问题,大三八快来

#10

帖子 adagio » 2009-12-06 21:40

居然明目张胆的去偷arch脚本,自己去TJJ :em11
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球

Re: slim的问题,大三八快来

#12

帖子 adagio » 2009-12-08 0:08

逗我玩是不?
scim启动跟登录管理器有个毛关系喔,你用什么桌面自己加启动组里洒
e17的话在设置里语言选项加
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
陽光院景仁
帖子: 1513
注册时间: 2009-09-25 20:19

Re: slim的问题,大三八快来

#13

帖子 陽光院景仁 » 2009-12-08 2:10

scim......不是slim
头像
photor
论坛版主
帖子: 11004
注册时间: 2008-04-26 12:41

Re: slim的问题,大三八快来

#14

帖子 photor » 2009-12-08 13:35

adagio 写了:逗我玩是不?
scim启动跟登录管理器有个毛关系喔,你用什么桌面自己加启动组里洒
e17的话在设置里语言选项加
那为什么用gdm的时候scim就能自动启动,用slim就不行?肯定是启动脚本不同,想搞清楚,学习一下叁 :em09
头像
jarryson
帖子: 4002
注册时间: 2005-08-14 19:53

Re: slim的问题,大三八快来

#15

帖子 jarryson » 2009-12-08 15:13

和启动管理器确实应该没关系。

这个脚本会自动加载~/.dmrc , ~/.xprofile,~/.xsession

一般吧要加载的写到~/.xprofile就可以了。默认使用~/.dmrc记住上次的会话,语言也在里面更改。

记得使用Xsession脚本的时候要把slim.conf里面的login_cmd改成:

代码: 全选

login_cmd           exec /bin/bash -login /etc/X11/Xsession %session
当然你可以另外改名成任意的名字,如果ubuntu自己有这个脚本的话,避免冲突
回复