[Xfce4-commits] <xfce4-session:nick/xfce-utils-merge> Add startxfce4 and xinit from xfce-utils.
Nick Schermer
noreply at xfce.org
Sat Jul 9 16:54:03 CEST 2011
Updating branch refs/heads/nick/xfce-utils-merge
to 3f56945695f76e76aa1179e05b56531f16b7e130 (commit)
from 8682926b430a7cd26c6416bb5718833992f42057 (commit)
commit 3f56945695f76e76aa1179e05b56531f16b7e130
Author: Nick Schermer <nick at xfce.org>
Date: Sat Jul 9 16:51:24 2011 +0200
Add startxfce4 and xinit from xfce-utils.
Makefile.am | 2 +
configure.in.in | 2 +
scripts/Makefile.am | 31 +++++
scripts/startxfce4.in | 94 +++++++++++++++
scripts/xinitrc.in.in | 309 +++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 438 insertions(+), 0 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 01f3542..a7334e4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,6 +7,7 @@ SUBDIRS = \
icons \
po \
settings \
+ scripts \
xfce4-session \
xfce4-session-logout \
xfsm-shutdown-helper \
@@ -19,6 +20,7 @@ endif
desktopdir = $(XSESSION_PREFIX)/share/xsessions
desktop_in_files = xfce.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+ at INTLTOOL_DESKTOP_RULE@
EXTRA_DIST = \
BUGS \
diff --git a/configure.in.in b/configure.in.in
index 3e52b52..6cb3529 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -274,6 +274,8 @@ libxfsm/xfce4-session-2.0.pc
panel-plugin/Makefile
po/Makefile.in
settings/Makefile
+scripts/Makefile
+scripts/xinitrc.in
xfce4-session/Makefile
xfce4-session-logout/Makefile
xfsm-shutdown-helper/Makefile
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
new file mode 100644
index 0000000..091094a
--- /dev/null
+++ b/scripts/Makefile.am
@@ -0,0 +1,31 @@
+bin_SCRIPTS= \
+ startxfce4
+
+# cannot be set from configure, because ${prefix} is not expanded
+edit = sed \
+ -e "s, at _datadir_\@,$(datadir),g" \
+ -e "s, at _libdir_\@,$(libdir),g" \
+ -e "s, at _docdir_\@,$$(dirname $(docdir)),g" \
+ -e "s, at _sysconfdir_\@,$(sysconfdir),g"
+
+startxfce4: Makefile $(srcdir)/startxfce4.in
+ rm -f startxfce4 startxfce4.tmp
+ $(edit) $(srcdir)/startxfce4.in >startxfce4.tmp
+ mv startxfce4.tmp startxfce4
+
+xinitrc: Makefile $(srcdir)/xinitrc.in
+ rm -f xinitrc xinitrc.tmp
+ $(edit) $(srcdir)/xinitrc.in >xinitrc.tmp
+ mv xinitrc.tmp xinitrc
+
+conffilesdir=@sysconfdir@/xdg/xfce4
+conffiles_DATA=\
+ xinitrc
+
+EXTRA_DIST = \
+ startxfce4.in \
+ xinitrc.in
+
+DISTCLEANFILES = \
+ startxfce4 \
+ xinitrc
diff --git a/scripts/startxfce4.in b/scripts/startxfce4.in
new file mode 100644
index 0000000..7a871d2
--- /dev/null
+++ b/scripts/startxfce4.in
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# xfce4
+#
+# Copyright (C) 1996-2003 Olivier Fourdan (fourdan at xfce.org)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+if test "x$XDG_CONFIG_HOME" = "x"
+then
+ BASEDIR="$HOME/.config/xfce4/"
+else
+ BASEDIR="$XDG_CONFIG_HOME/xfce4"
+fi
+
+if test "x$XDG_DATA_DIRS" = "x"
+then
+ if test "x at _datadir_@" = "x/usr/local/share" -o "x at _datadir_@" = "x/usr/share"; then
+ XDG_DATA_DIRS="/usr/local/share:/usr/share"
+ else
+ XDG_DATA_DIRS="@_datadir_@:/usr/local/share:/usr/share"
+ fi
+else
+ XDG_DATA_DIRS="$XDG_DATA_DIRS:@_datadir_@"
+fi
+export XDG_DATA_DIRS
+
+if test "x$XDG_CONFIG_DIRS" = "x"
+then
+ if test "x at _sysconfdir_@" = "x/etc"; then
+ XDG_CONFIG_DIRS="/etc/xdg"
+ else
+ XDG_CONFIG_DIRS="/etc/xdg:@_sysconfdir_@/xdg"
+ fi
+else
+ XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS:@_sysconfdir_@/xdg"
+fi
+export XDG_CONFIG_DIRS
+
+if test "x$DISPLAY" = "x"
+then
+ echo "$0: Starting X server"
+ prog=xinit
+else
+ echo "$0: X server already running on display $DISPLAY"
+ prog=/bin/sh
+fi
+
+if test ! "x$*" = "x"
+then
+ OPT=$*
+ if test "x${OPT#*--}" = "x${OPT}"
+ then
+ CLIENTRC=${OPT}
+ else
+ SERVERRC=${OPT#*-- }
+ CLIENTRC=${OPT%--*}
+ fi
+fi
+
+if [ -f "$HOME/.xserverrc" ]; then
+ SERVERRC="$HOME/.xserverrc $SERVERRC"
+elif [ -f /etc/X11/xinit/xserverrc ]; then
+ SERVERRC="/etc/X11/xinit/xserverrc $SERVERRC"
+fi
+
+if test ! "x$SERVERRC" = "x"
+then
+ SERVERRC="-- $SERVERRC"
+fi
+
+if [ -f $BASEDIR/xinitrc ]; then
+ exec $prog $BASEDIR/xinitrc $CLIENTRC $SERVERRC
+elif [ -f $HOME/.xfce4/xinitrc ]; then
+ mkdir -p $BASEDIR
+ cp $HOME/.xfce4/xinitrc $BASEDIR/
+ exec $prog $BASEDIR/xinitrc $CLIENTRC $SERVERRC
+else
+ exec $prog @_sysconfdir_@/xdg/xfce4/xinitrc $CLIENTRC $SERVERRC
+fi
+
diff --git a/scripts/xinitrc.in.in b/scripts/xinitrc.in.in
new file mode 100755
index 0000000..f582934
--- /dev/null
+++ b/scripts/xinitrc.in.in
@@ -0,0 +1,309 @@
+#!/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
+
+# set $XDG_MENU_PREFIX to "xfce-" so that "xfce-applications.menu" is picked
+# over "applications.menu" in all Xfce applications.
+if test "x$XDG_MENU_PREFIX" = "x"; then
+ XDG_MENU_PREFIX="xfce-"
+ export XDG_MENU_PREFIX
+fi
+
+# set DESKTOP_SESSION so that one can detect easily if an Xfce session is running
+if test "x$DESKTOP_SESSION" = "x"; then
+ DESKTOP_SESSION="xfce"
+ export DESKTOP_SESSION
+fi
+
+# $XDG_CONFIG_HOME defines the base directory relative to which user specific
+# configuration files should be stored. If $XDG_CONFIG_HOME is either not set
+# or empty, a default equal to $HOME/.config should be used.
+if test "x$XDG_CONFIG_HOME" = "x" ; then
+ XDG_CONFIG_HOME=$HOME/.config
+fi
+[ -d "$XDG_CONFIG_HOME" ] || mkdir "$XDG_CONFIG_HOME"
+
+# $XDG_CACHE_HOME defines the base directory relative to which user specific
+# non-essential data files should be stored. If $XDG_CACHE_HOME is either not
+# set or empty, a default equal to $HOME/.cache should be used.
+if test "x$XDG_CACHE_HOME" = "x" ; then
+ XDG_CACHE_HOME=$HOME/.cache
+fi
+[ -d "$XDG_CACHE_HOME" ] || mkdir "$XDG_CACHE_HOME"
+
+
+# set up XDG user directores. see
+# http://freedesktop.org/wiki/Software/xdg-user-dirs
+if which xdg-user-dirs-update >/dev/null 2>&1; then
+ xdg-user-dirs-update
+fi
+
+if test -f "$XDG_CONFIG_HOME/user-dirs.dirs"; then
+ . "$XDG_CONFIG_HOME/user-dirs.dirs"
+ # i'm deliberately not 'export'-ing the XDG_ vars, because you shouldn't
+ # rely on the env vars inside apps, since the file could be changed at
+ # any time by the user. this is solely here for migration purposes.
+
+ # a bit of user dir migration...
+ if test -d "$HOME/Desktop" -a ! -L "$HOME/Desktop" \
+ -a "$XDG_DESKTOP_DIR" \
+ -a "$HOME/Desktop" != "$XDG_DESKTOP_DIR"
+ then
+ echo "Migrating $HOME/Desktop to $XDG_DESKTOP_DIR..."
+ test -d "$XDG_DESKTOP_DIR" && rmdir "$XDG_DESKTOP_DIR"
+ mv "$HOME/Desktop" "$XDG_DESKTOP_DIR" || echo "Desktop migration failed" >&2
+ fi
+
+ if test -d "$HOME/Templates" -a ! -L "$HOME/Templates" \
+ -a "$XDG_TEMPLATES_DIR" \
+ -a "$HOME/Templates" != "$XDG_TEMPLATES_DIR"
+ then
+ echo "Migrating $HOME/Templates to $XDG_TEMPLATES_DIR..."
+ test -d "$XDG_TEMPLATES_DIR" && rmdir "$XDG_TEMPLATES_DIR"
+ mv "$HOME/Templates" "$XDG_TEMPLATES_DIR" || echo "Templates migration failed" >&2
+ fi
+fi
+
+
+# Modify libglade and glade environment variables so that
+# it will find the files installed by Xfce
+LIBGLADE_MODULE_PATH="$LIBGLADE_MODULE_PATH:@XFCE_LIBGLADE_MODULE_PATH@"
+GLADE_CATALOG_PATH="$GLADE_CATALOG_PATH:@XFCE_GLADE_CATALOG_PATH@"
+GLADE_PIXMAP_PATH="$GLADE_PIXMAP_PATH:@XFCE_GLADE_PIXMAP_PATH@"
+GLADE_MODULE_PATH="$GLADE_MODULE_PATH:@XFCE_GLADE_MODULE_PATH@"
+export LIBGLADE_MODULE_PATH
+export GLADE_CATALOG_PATH
+export GLADE_PIXMAP_PATH
+export GLADE_MODULE_PATH
+
+# Export GTK_PATH so that GTK+ can find the Xfce theme engine
+# https://bugzilla.xfce.org/show_bug.cgi?id=7483
+#GTK_PATH="$GTK_PATH:@_libdir_@/gtk-2.0"
+#export GTK_PATH
+
+# For now, start with an empty list
+XRESOURCES=""
+
+# Has to go prior to merging Xft.xrdb, as its the "Defaults" file
+test -r "@_sysconfdir_@/xdg/xfce4/Xft.xrdb" && XRESOURCES="$XRESOURCES @_sysconfdir_@/xdg/xfce4/Xft.xrdb"
+test -r $HOME/.Xdefaults && XRESOURCES="$XRESOURCES $HOME/.Xdefaults"
+
+BASEDIR=$XDG_CONFIG_HOME/xfce4
+if test -r "$BASEDIR/Xft.xrdb"; then
+ XRESOURCES="$XRESOURCES $BASEDIR/Xft.xrdb"
+elif test -r "$XFCE4HOME/Xft.xrdb"; then
+ mkdir -p "$BASEDIR"
+ cp "$XFCE4HOME/Xft.xrdb" "$BASEDIR"/
+ XRESOURCES="$XRESOURCES $BASEDIR/Xft.xrdb"
+fi
+
+# merge in X cursor settings
+test -r "$BASEDIR/Xcursor.xrdb" && XRESOURCES="$XRESOURCES $BASEDIR/Xcursor.xrdb"
+
+# ~/.Xresources contains overrides to the above
+test -r "$HOME/.Xresources" && XRESOURCES="$XRESOURCES $HOME/.Xresources"
+
+# load all X resources (adds /dev/null to avoid an empty list that would hang the process)
+cat /dev/null $XRESOURCES | xrdb -nocpp -merge -
+
+# load local modmap
+test -r $HOME/.Xmodmap && xmodmap $HOME/.Xmodmap
+
+# Use dbus-launch if installed.
+if test x"$DBUS_SESSION_BUS_ADDRESS" = x""; then
+ if which dbus-launch >/dev/null 2>&1; then
+ eval `dbus-launch --sh-syntax --exit-with-session`
+ # some older versions of dbus don't export the var properly
+ export DBUS_SESSION_BUS_ADDRESS
+ else
+ echo "Could not find dbus-launch; Xfce will not work properly" >&2
+ fi
+fi
+
+# launch gpg-agent or ssh-agent if enabled.
+ssh_agent_enabled=`xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled 2> /dev/null`
+if test "$ssh_agent_enabled" != "false"; then
+ # if the user has pam_ssh installed, it will start ssh-agent for us, but
+ # of course won't start gpg-agent. so, if ssh-agent is already running,
+ # but we want gpg-agent (and that's not running yet) start gpg-agent
+ # without ssh support
+
+ ssh_agent_type=`xfconf-query -c xfce4-session -p /startup/ssh-agent/type 2> /dev/null`
+ if test -z "$ssh_agent_type"; then
+ if which gpg-agent >/dev/null 2>&1; then
+ ssh_agent_type=gpg-agent
+ else
+ ssh_agent_type=ssh-agent
+ fi
+ fi
+
+ # ignore stale ssh-agents
+ if test "$SSH_AGENT_PID"; then
+ if ! kill -0 $SSH_AGENT_PID; then
+ unset SSH_AGENT_PID
+ unset SSH_AUTH_SOCK
+ fi
+ fi
+
+ case "$ssh_agent_type" in
+ gpg-agent)
+ if test -z "$SSH_AGENT_PID"; then
+ eval `gpg-agent --daemon --enable-ssh-support --write-env-file $XDG_CACHE_HOME/gpg-agent-info`
+ ssh_agent_kill_cmd="kill -INT $SSH_AGENT_PID; rm -f $XDG_CACHE_HOME/gpg-agent-info"
+ elif test -z "$GPG_AGENT_INFO"; then
+ echo "ssh-agent is already running; starting gpg-agent without ssh support"
+ eval `gpg-agent --daemon --write-env-file $XDG_CACHE_HOME/gpg-agent-info`
+ ssh_agent_kill_cmd="pkill -INT ^gpg-agent\$; rm -f $XDG_CACHE_HOME/gpg-agent-info"
+ else
+ echo "gpg-agent is already running"
+ fi
+ ;;
+
+ ssh-agent)
+ if test -z "$SSH_AGENT_PID"; then
+ eval `ssh-agent -s`
+ ssh_agent_kill_cmd="ssh-agent -s -k"
+ else
+ echo "ssh-agent is already running"
+ fi
+ ;;
+
+ *)
+ echo "Unrecognized agent type '$ssh_agent_type'" >&2
+ ;;
+ esac
+fi
+
+
+# launch a screensaver if enabled. do not launch if we're root or if
+# we're in a VNC session.
+screensaver_enabled=`xfconf-query -c xfce4-session -p /startup/screensaver/enabled 2> /dev/null`
+if test $UID -gt 0 -a -z "$VNCSESSION" -a "$screensaver_enabled" != "false"; then
+ screensaver_type=`xfconf-query -c xfce4-session -p /startup/screensaver/type 2> /dev/null`
+
+ case "$screensaver_type" in
+ xscreensaver)
+ xscreensaver -no-splash &
+ ;;
+
+ gnome-screensaver)
+ gnome-screensaver &
+ ;;
+
+ *)
+ if test x"`which xscreensaver 2>/dev/null`" != x""; then
+ xscreensaver -no-splash &
+ elif test x"`which gnome-screensaver 2>/dev/null`" != x""; then
+ gnome-screensaver &
+ fi
+ ;;
+ esac
+fi
+
+
+# Run xfce4-session if installed
+if which xfce4-session >/dev/null 2>&1; then
+ xfce4-session
+
+ if test "$ssh_agent_kill_cmd"; then
+ echo "running '$ssh_agent_kill_cmd'"
+ eval "$ssh_agent_kill_cmd"
+ fi
+
+ exit 0
+fi
+
+
+##################
+# IMPORTANT NOTE #
+##################
+
+# Everything below here ONLY gets executed if you are NOT using xfce4-session
+# (Xfce's session manager). If you are using the session manager, everything
+# below is handled by it, and the code below is not executed at all. If you're
+# not sure if you're using the session manager, type 'ps -e|grep xfce4-session'
+# in a terminal while Xfce is running.
+
+##################
+
+
+# this is only necessary when running w/o xfce4-session
+xsetroot -solid black -cursor_name watch
+
+# or use old-fashioned startup script otherwise
+
+xfsettingsd &
+xfwm4 --daemon
+
+# start up stuff in $XDG_CONFIG_HOME/autostart/, as that looks to be
+# the new standard. if that directory doesn't exist, try the old
+# ~/Desktop/Autostart method. we're not going to do any migration here.
+if test -d "$XDG_CONFIG_HOME/autostart"; then
+ for i in ${XDG_CONFIG_HOME}/autostart/*.desktop; do
+ grep -q -E "^Hidden=true" "$i" && continue
+ if grep -q -E "^OnlyShowIn=" "$i"; then
+ # need to test twice, as lack of the line entirely means we still run it
+ grep -E "^OnlyShowIn=" "$i" | grep -q 'XFCE;' || continue
+ fi
+ grep -E "^NotShowIn=" "$i" | grep -q 'XFCE;' && continue
+
+ # check for TryExec
+ trycmd=`grep -E "^TryExec=" "$i" | cut -d'=' -f2`
+ if test "$trycmd"; then
+ which "$trycmd" >/dev/null 2>&1 || continue
+ fi
+
+ cmd=`grep -E "^Exec=" "$i" | cut -d'=' -f2`
+ if test "$cmd" && which "$cmd" >/dev/null 2>&1; then
+ $cmd &
+ fi
+ done
+elif test -d "$HOME/Desktop/Autostart"; then
+ for i in `ls -1 -L ${HOME}/Desktop/Autostart/ 2>/dev/null`; do
+ if test -x $HOME/Desktop/Autostart/$i; then
+ $HOME/Desktop/Autostart/$i &
+ fi
+ done
+fi
+
+xfdesktop&
+orage &
+
+panel=`which xfce4-panel`
+case "x$panel" in
+ x|xno*)
+ ;;
+ *)
+ $panel
+ ret=$?
+ while test $ret -ne 0; do
+ xmessage -center -file - -timeout 20 -title Error <<EOF
+A crash occured in the panel
+Please report this to the xfce4-dev at xfce.org list
+or on http://bugs.xfce.org
+Meanwhile the panel will be restarted
+EOF
+ cat >&2 <<EOF
+A crash occured in the panel
+Please report this to the xfce4-dev at xfce.org list
+or on http://bugs.xfce.org
+Meanwhile the panel will be restarted
+EOF
+ $panel
+ ret=$?
+ done
+ ;;
+esac
+
+if test "$ssh_agent_kill_cmd"; then
+ eval "$ssh_agent_kill_cmd"
+fi
+
+xsetroot -bg white -fg red -solid black -cursor_name watch
More information about the Xfce4-commits
mailing list