分类: LINUX
2014-07-23 15:13:29
系统环境:centos 6.5 x64
通过 startx 来启动 xfce4
通过分析startx发现startx 实际是调xinit 来启动xserver 和 xclient,而xinit 是通过/etc/X11/xinitrc 来执行,而xinitrc 中通过调用Xclients 来确定启用哪个x-window。所以我们来对Xclients 文件进行相应的修改就能实现我们的目的。
实现方法两种分别如下:
A) 此方法适用于只装有xfce4 这一个桌面环境
#cat /etc/X11/xinit/Xclients //蓝色部分为添加的代码
GSESSION="$(which gnome-session 2>/dev/null)"
STARTKDE="$(which startkde 2>/dev/null)"
STARTXFCE="$(which startxfce4 2>/dev/null)"
# check to see if the user has a preferred desktop
PREFERRED=
if [ -f /etc/sysconfig/desktop ]; then
. /etc/sysconfig/desktop
if [ "$DESKTOP" = "GNOME" ]; then
PREFERRED="$GSESSION"
elif [ "$DESKTOP" = "KDE" ]; then
PREFERRED="$STARTKDE"
fi
fi
if [ -n "$PREFERRED" ]; then
exec "$PREFERRED"
fi
# now if we can reach here, either no desktop file was present,
# or the desktop requested is not installed.
if [ -n "$GSESSION" ]; then
# by default, we run GNOME.
exec "$GSESSION"
elif [ -n "$STARTKDE" ]; then
# if GNOME isn't installed, try KDE.
exec "$STARTKDE"
elif [ -n "$STARTXFCE" ]; then
# if GNOME and KDE isn't installed, try xfce4.
exec "$STARTXFCE"
fi
B) 此方法适用于装有多个桌面管理(桌面环境),要启动哪个只需修改 /etc/sysconfig/desktop 的值即可
# touch /etc/sysconfig/desktop
# cat /etc/sysconfig/desktop
DESKTOP=”XFCE”
#cat /etc/X11/xinit/Xclients //蓝色部分为添加的代码
GSESSION="$(which gnome-session 2>/dev/null)"
STARTKDE="$(which startkde 2>/dev/null)"
STARTXFCE="$(which startxfce4 2>/dev/null)"
# check to see if the user has a preferred desktop
PREFERRED=
if [ -f /etc/sysconfig/desktop ]; then
. /etc/sysconfig/desktop
if [ "$DESKTOP" = "GNOME" ]; then
PREFERRED="$GSESSION"
elif [ "$DESKTOP" = "KDE" ]; then
PREFERRED="$STARTKDE"
elif [ "$DESKTOP" = "XFCE" ]; then
PREFERRED="$STARTXFCE"
fi
fi
if [ -n "$PREFERRED" ]; then
exec "$PREFERRED"
fi
# now if we can reach here, either no desktop file was present,
# or the desktop requested is not installed.
if [ -n "$GSESSION" ]; then
# by default, we run GNOME.
exec "$GSESSION"
elif [ -n "$STARTKDE" ]; then
# if GNOME isn't installed, try KDE.
exec "$STARTKDE"
fi
C)
echo "exec startxfce4" > ~/.xinitrc
Xfce4 定制
面板栏定制
第一次启动时点使用 默认配置则是根据/etc/xdg/xfce4/panel/default.xml 来生成面板
并且在 ~/.config 下建立 xfc4 的文件夹里面放着当前环境下的配置文件
# cat /etc/xdg/xfce4/panel/default.xml
[root@localhost panel]# more default.xml.bak
上述列出的插件均在 /usr/share/xfce4/panel/plugins 目录下面
主菜单定制
主菜单的控制是 /etc/xdg/menus/xfce-applications.menu
# cd /etc/xdg/menus
# more xfce-applications.menu
"">
去除或隐藏某些不用的菜单
# cd /usr/share/applications
A)
# echo "Hidden=true" >> exo-mail-reader.desktop
# echo "Hidden=true" >> exo-web-browser.desktop
# echo "Hidden=true" >> xfhelp4.desktop
# echo "Hidden=true" >> %\{desk-vendor\}-abrt.desktop
或者
B)
# rm exo-mail-reader.desktop
# rm exo-web-browser.desktop
# rm xfhelp4.desktop
# rm %\{desk-vendor\}-abrt.desktop
Xfce4 菜单汉化
在root 用户下菜单默认显示英文,要将让其显示中文通过以下方法可以达到:
# export LC_ALL=”zh_CN.UTF-8”
# cat /etc/sysconfig/i18n
LANG=”zh_CN.UTF”
参考链接:
Xfce4桌面环境及中文化 - jues
Xfce 4.10 导航 - Xfce
Gentoo Linux文档 -- Xfce配置指南
xfce:xfdesktop:usage [Xfce Docs]
start [Xfce Docs]
xfce:getting-started [Xfce Docs]
Recognized desktop entry keys