Pointing Xfce To A New Directory For Configurations


Pleng

Well-Known Member
Joined
Dec 28, 2006
Messages
3,030
I'm working on a GUI that makes use of the XFCE panel and matchbox window manager, and I therefore need to be able to store an alternate version of XFCE's configuration settings. My startup script for the environment is hacked together with bits of .xinitrc and startxfce4 and looks like this:

Code:
#!/bin/sh

# set up XDG user directores.  see
# http://freedesktop.org/wiki/Software/xdg-user-dirs
if type xdg-user-dirs-update >/dev/null 2>&1; then
    xdg-user-dirs-update
fi

if test "x$XDG_CONFIG_HOME" = "x"
then
  BASEDIR="$HOME/.config/oohgui/"
else
  BASEDIR="$XDG_CONFIG_HOME/oohgui"
fi

if test "x$XDG_DATA_DIRS" = "x"
then
  XDG_DATA_DIRS="/usr/local/share:/usr/share:/usr/share"
else
  XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"
fi
export XDG_DATA_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


# 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

# $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"


# Modify libglade and glade environment variables so that
# it will find the files installed by Xfce
export LIBGLADE_MODULE_PATH="$LIBGLADE_MODULE_PATH:/usr/lib/libglade/2.0"
export GLADE_CATALOG_PATH="$GLADE_CATALOG_PATH:"
export GLADE_PIXMAP_PATH="$GLADE_PIXMAP_PATH:"
export GLADE_MODULE_PATH="$GLADE_MODULE_PATH:"


# Export GTK_PATH so that GTK+ can find the Xfce theme engine
export GTK_PATH="$GTK_PATH:/usr/lib/gtk-2.0"


# For now, start with an empty list
XRESOURCES=""

# Has to go prior to merging Xft.xrdb, as its the "Defaults" file
test -r "/etc/xdg/xfce4/Xft.xrdb" && XRESOURCES="$XRESOURCES /etc/xdg/xfce4/Xft.xrdb"
test -r $HOME/.Xdefaults && XRESOURCES="$XRESOURCES $HOME/.Xdefaults"

[b]BASEDIR=$XDG_CONFIG_HOME/oohgui[/b]
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

# Launch xscreensaver (if available), but only as non-root user
if test $UID -gt 0 -a -z "$VNCSESSION"; then 
    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
fi 

# Use ssh-agent if installed and not already running.  Run it separately
# so it populates the environment here, so we can clean it up later.
sshagent=`which ssh-agent`
kill_sshagent=0
if test -z "$SSH_AGENT_PID" -a "$sshagent" -a "x$sshagent" != "xno"; then
    eval `$sshagent -s`
    kill_sshagent=1
fi

# Use dbus-launch if installed.
if test x"$DBUS_SESSION_BUS_ADDRESS" = x""; then
    dbuslaunch=`which dbus-launch`
    if test x"$dbuslaunch" != x"" -a x"$dbuslaunch" != x"no"; then
        eval `$dbuslaunch --sh-syntax --exit-with-session`
    fi
fi

xfsettingsd &


##add pleng
thunnar --daemon &
nm-applet &
matchbox-window-manager -use_titlebar no &

##more pleng

mkdir /tmp/Browser
cp $HOME/.scripts/plengui/* /tmp/Browser
thunar --name="Home" /tmp/Browser &
xfce4-panel

I have highlighted in bold where I would have thought I had done enough to change the settings directory, but whenever I log into XFCE4, make some changes, and re login to ohhgui, the settings from XFCE are carried over.

Any ideas what I'm doing wrong?!!
 
Pleng said:
Code:
# $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"
 
Last edited by a moderator:
Ok so I've removed those lines but still its not working. Any other ideas??
 
Pleng said:
Ok so I've removed those lines but still its not working. Any other ideas??
By the freedesktop norm, XDG_CONFIG_HOME, set the configuration folder for everyone,
So In the code, change its value and the configurations files will take from the new directory
I've no idea what BASEDIR should mean but it seam to be just avariable within the script and not something shared...

so if you
export XDG_CONFIG_HOME=$HOME/.config2
you'll start with a fresh new configuration directory.
 
Last edited by a moderator:
BASEDIR is where the xfce4 config files are kept. In the original file it had BASEDIR=$XDG_CONFIG_HOME/xfce4 ... which I changed to BASEDIR=$XDG_CONFIG_HOME/oohgui, which has a copy of all the files in xfce4 (including panel settings.

And if I export in the script then I'm always going to be copying the settings from XFCE - so that's not solving the problem :(
 
Sorry to bump... any other ideas anybody? I can't 'release' oohgui without being able to sort this :(
 
Ok I promise.... final bump, but anybody got an idea on this?
 
I already tried to help you here. I don't get what you want to do.

If you want XFCE to use $XDG_CONFIG_HOME/oohgui as config dir instead of $XDG_CONFIG_HOME/xfce4, it won't work until you recompile xfce to change the hard-coded "$XDG_CONFIG_HOME/xfce4" value as specified by freedesktop. That's pretty much why urjaman and I have pointing you to change XDG_CONFIG_HOME env variable instead.
 
Ah ok I see what you're saying. Seem strange that the XFCE startup file has the line BASEDIR=$XDG_CONFIG_HOME/xfce4 in it, if the path is actually hard coded into the binary. Still, I'll have a go at changing the value for $XDG_CONFIG_HOME , though this probably means doubling up on a bit of unnecessary stuff.
 
OK So I've inserted the line:

XDG_CONFIG_HOME = $HOME/Applications/ohhgui/Settings

to the startup script.

Now... when I switch between XFCE and oohgui, the CONTENTS of the Panel change. Result! However the theme / colour scheme does NOT change.

If I set the DEFAULT gui to xfce then it boots up with the colour scheme set in XFCE. If I the default gui to ohhgui then it boots up with the colour scheme set in ohhgui - changing between guis once booted doesn't have any effect. Any ideas???
 
Pleng said:
OK So I've inserted the line:

XDG_CONFIG_HOME = $HOME/Applications/ohhgui/Settings

to the startup script.

Now... when I switch between XFCE and oohgui, the CONTENTS of the Panel change. Result! However the theme / colour scheme does NOT change.

If I set the DEFAULT gui to xfce then it boots up with the colour scheme set in XFCE. If I the default gui to ohhgui then it boots up with the colour scheme set in ohhgui - changing between guis once booted doesn't have any effect. Any ideas???
Yes, gconfd have to be restarted ;)
 
Last edited by a moderator:
Pleng said:
Great... How?? :)
"restart gconfd" is a good google keyword
EDIT: I'm having a bad day with support... sorry.

gconftool-2 --shutdown
seams to do it but I cant test.
 
Last edited by a moderator:
no worries, I think you're doing spectacular with support.

I did think of googling it but couldn't be bothered, to be honest... I only ever use ohhgui... the only reason I'm trying to sort this out is so I can share it with anybody else who may be interested.

I will give your method a go tomorrow when the beer has worn off somewhat :D
 
Back
Top