From 899a21d45d5dded72ea19b7856626d9e0419be85 Mon Sep 17 00:00:00 2001
From: markt <markt>
Date: Sat, 7 Jul 2007 23:12:28 +0000
Subject: some fixes for --program-prefix and --program-suffix, plus fix
 overwriting init file on reconfigure

---
 data/Makefile.am              |  5 ++++
 data/init.in                  |  6 ++---
 src/Makefile.am               | 13 +++++++++
 src/MenuCreator.cc            |  3 ++-
 src/RootCmdMenuItem.cc        |  8 +++---
 src/RootCmdMenuItem.hh        |  2 +-
 src/RootTheme.cc              |  9 ++++---
 src/Workspace.cc              |  2 ++
 src/fluxbox.cc                | 23 +++++++---------
 src/fluxbox.hh                |  3 +--
 util/Makefile.am              |  2 ++
 util/fluxbox-generate_menu.in | 62 ++++++++++++++++++++++---------------------
 util/startfluxbox.in          |  9 ++++---
 13 files changed, 85 insertions(+), 62 deletions(-)

diff --git a/data/Makefile.am b/data/Makefile.am
index 2a99ce4..18a05cc 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,5 +1,8 @@
 # data/Makefile.am for Fluxbox - an X11 Window manager
 
+PROGRAM_PREFIX=@program_prefix@
+PROGRAM_SUFFIX=@program_suffix@
+
 DEFAULT_MENU = @DEFAULT_MENU@
 DEFAULT_STYLE = @DEFAULT_STYLE@
 DEFAULT_KEYS = @DEFAULT_KEYS@
@@ -26,6 +29,8 @@ distclean-local:
 		rm -f *\~
 init: 			init.in
 	@regex_cmd@ -e "s,@pkgdatadir@,$(pkgdatadir),g" \
+			-e "s,@pkgprefix@,$(PROGRAM_PREFIX:NONE=),g" \
+			-e "s,@pkgsuffix@,$(PROGRAM_SUFFIX:NONE=),g" \
 			-e "s,@default_style@,$(DEFAULT_STYLE),g" $(srcdir)/init.in > init
 
 menu: 			../util/fluxbox-generate_menu
diff --git a/data/init.in b/data/init.in
index 2dfbc5b..5ad9aa3 100644
--- a/data/init.in
+++ b/data/init.in
@@ -3,8 +3,6 @@ session.screen0.slit.direction:	Vertical
 session.screen0.slit.onTop:	False
 session.screen0.slit.autoHide:	False
 session.screen0.tab.placement:	Top
-session.screen0.tab.alignment:	Left
-session.screen0.tab.rotatevertical:	True
 session.screen0.toolbar.onTop:	False
 session.screen0.toolbar.autoHide:	False
 session.screen0.toolbar.placement:	BottomCenter
@@ -25,10 +23,10 @@ session.screen0.tab.height:	16
 session.screen0.showwindowposition: true
 session.opaqueMove:	False
 session.autoRaiseDelay:	250
-session.menuFile:	~/.fluxbox/menu
+session.menuFile:	~/.@pkgprefix@fluxbox@pkgsuffix@/menu
 session.cacheLife:	5
 session.styleFile:	@default_style@
-session.keyFile: ~/.fluxbox/keys
+session.keyFile: ~/.@pkgprefix@fluxbox@pkgsuffix@/keys
 session.colorsPerChannel:	4
 session.doubleClickInterval:	250
 session.cacheMax:	200
diff --git a/src/Makefile.am b/src/Makefile.am
index 0f3395e..f66ddc9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,6 +28,8 @@ DEFAULT_MENU=@DEFAULT_MENU@
 DEFAULT_STYLE=$(pkgdatadir)/styles/Clean
 DEFAULT_KEYSFILE=@DEFAULT_KEYS@
 DEFAULT_INITFILE=@DEFAULT_INIT@
+PROGRAM_PREFIX=@program_prefix@
+PROGRAM_SUFFIX=@program_suffix@
 
 AM_CPPFLAGS=-I$(srcdir)/FbTk
 
@@ -37,14 +39,25 @@ CONFIG_CLEAN_FILES = defaults.hh
 defaults.hh: Makefile
 	@( \
 		echo '// This file is generated from Makefile. Do not edit!'; \
+		echo '#include <string>'; \
+		echo ''; \
 		echo '#define DEFAULTMENU "$(DEFAULT_MENU)"'; \
 		echo '#define DEFAULTSTYLE "$(DEFAULT_STYLE)"'; \
 		echo '#define DEFAULTKEYSFILE "$(DEFAULT_KEYSFILE)"'; \
 		echo '#define DEFAULT_INITFILE "$(DEFAULT_INITFILE)"'; \
+		echo '#define PROGRAM_PREFIX "$(PROGRAM_PREFIX:NONE=)"'; \
+		echo '#define PROGRAM_SUFFIX "$(PROGRAM_SUFFIX:NONE=)"'; \
+		echo 'std::string realProgramName(std::string name);'; \
 		echo 'const char* svnversion(void);' ) > defaults.hh
 
 defaults.cc: force
 	@( \
+		echo '#include "defaults.hh"'; \
+		echo ''; \
+		echo 'std::string realProgramName(std::string name) {'; \
+		echo '  return PROGRAM_PREFIX + name + PROGRAM_SUFFIX;'; \
+		echo '}'; \
+		echo ''; \
 		echo 'const char* svnversion(void) {'; \
 		echo '  return "'`(svnversion . | sed "s/[^0-9].*//") 2> /dev/null`'";';\
 		echo '}' ) > defaults_tmp.cc
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index a04860f..16acfb8 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -24,6 +24,7 @@
 
 #include "MenuCreator.hh"
 
+#include "defaults.hh"
 #include "Screen.hh"
 #include "CommandParser.hh"
 #include "fluxbox.hh"
@@ -347,7 +348,7 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem, FbTk::StringConve
     else if (str_key == "wallpapers" || str_key == "wallpapermenu" ||
              str_key == "rootcommands") {
          createRootCmdMenu(menu, str_label, str_label,
-                          str_cmd == "" ? "fbsetbg" : str_cmd);
+                          str_cmd == "" ? realProgramName("fbsetbg") : str_cmd);
     } // end of wallpapers
     else if (str_key == "workspaces") {
         BScreen *screen = Fluxbox::instance()->findScreen(screen_number);
diff --git a/src/RootCmdMenuItem.cc b/src/RootCmdMenuItem.cc
index eabc5d3..a52a4d8 100644
--- a/src/RootCmdMenuItem.cc
+++ b/src/RootCmdMenuItem.cc
@@ -23,6 +23,7 @@
 
 #include "RootCmdMenuItem.hh"
 
+#include "defaults.hh"
 #include "FbCommands.hh"
 #include "fluxbox.hh"
 
@@ -33,9 +34,10 @@ RootCmdMenuItem::RootCmdMenuItem(const FbTk::FbString &label,
                              const std::string &cmd):
     FbTk::MenuItem(label), 
     m_filename(filename) {
-    
-      FbTk::RefCount<FbTk::Command> 
-        setwp_cmd(new FbCommands::ExecuteCmd(cmd + " \"" + m_filename + "\""));
+
+    std::string prog = cmd.empty() ? realProgramName("fbsetbg") : cmd;
+    FbTk::RefCount<FbTk::Command>
+        setwp_cmd(new FbCommands::ExecuteCmd(prog + " \"" + m_filename + "\""));
     setCommand(setwp_cmd);
     setToggleItem(true);
 }
diff --git a/src/RootCmdMenuItem.hh b/src/RootCmdMenuItem.hh
index 8c8ac8d..4a541d9 100644
--- a/src/RootCmdMenuItem.hh
+++ b/src/RootCmdMenuItem.hh
@@ -31,7 +31,7 @@ class RootCmdMenuItem: public FbTk::MenuItem {
 public:
     RootCmdMenuItem(const FbTk::FbString &label, 
                   const std::string &filename,
-                  const std::string &cmd = "fbsetbg");
+                  const std::string &cmd = "");
     bool isSelected() const;
 private:
     const std::string m_filename;
diff --git a/src/RootTheme.cc b/src/RootTheme.cc
index 5189fbb..90478e3 100644
--- a/src/RootTheme.cc
+++ b/src/RootTheme.cc
@@ -23,6 +23,7 @@
 
 #include "RootTheme.hh"
 
+#include "defaults.hh"
 #include "FbRootWindow.hh"
 #include "FbCommands.hh"
 #include "Screen.hh"
@@ -212,7 +213,8 @@ void RootTheme::reconfigTheme() {
             options = "-A ";
             
         // compose wallpaper application "fbsetbg" with argumetns
-        std::string commandargs = "fbsetbg " + options + filename;
+        std::string commandargs = realProgramName("fbsetbg") + " " + options +
+                                  filename;
 
         // call command with options
         FbCommands::ExecuteCmd exec(commandargs, screenNum());
@@ -220,7 +222,8 @@ void RootTheme::reconfigTheme() {
 
     } else if (FbTk::FileUtil::isDirectory(filename.c_str()) &&
             strstr(m_background->options().c_str(), "random") != 0) {
-        std::string commandargs = "fbsetbg -R " + filename;
+        std::string commandargs = realProgramName("fbsetbg") + " -R " +
+                                  filename;
         FbCommands::ExecuteCmd exec(commandargs, screenNum());
         exec.execute();
     } else {
@@ -251,7 +254,7 @@ void RootTheme::reconfigTheme() {
             options += "-gradient '" + m_background->options() + "'";
         }
 
-        std::string commandargs = "fbsetroot " + options;
+        std::string commandargs = realProgramName("fbsetroot") + " " + options;
 
         FbCommands::ExecuteCmd exec(commandargs, screenNum());
         exec.execute();
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 2933ab5..fe30a8f 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -171,6 +171,8 @@ size_t Workspace::numberOfWindows() const {
 
 void Workspace::setName(const string &name) {
     if (!name.empty() && name != "") {
+        if (name == m_name)
+            return;
         m_name = name;
     } else { //if name == 0 then set default name from nls
         _FB_USES_NLS;
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 57597a2..bad558b 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -202,11 +202,11 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
       m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"),
       m_rc_tabs_padding(m_resourcemanager, 0, "session.tabPadding", "Session.TabPadding"),
       m_rc_stylefile(m_resourcemanager, DEFAULTSTYLE, "session.styleFile", "Session.StyleFile"),
-      m_rc_styleoverlayfile(m_resourcemanager, "~/.fluxbox/overlay", "session.styleOverlay", "Session.StyleOverlay"),
+      m_rc_styleoverlayfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/overlay", "session.styleOverlay", "Session.StyleOverlay"),
       m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"),
       m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"),
-      m_rc_slitlistfile(m_resourcemanager, "~/.fluxbox/slitlist", "session.slitlistFile", "Session.SlitlistFile"),
-      m_rc_appsfile(m_resourcemanager, "~/.fluxbox/apps", "session.appsFile", "Session.AppsFile"),
+      m_rc_slitlistfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/slitlist", "session.slitlistFile", "Session.SlitlistFile"),
+      m_rc_appsfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/apps", "session.appsFile", "Session.AppsFile"),
       m_rc_tabs_attach_area(m_resourcemanager, ATTACH_AREA_WINDOW, "session.tabsAttachArea", "Session.TabsAttachArea"),
       m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"),
       m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"),
@@ -226,7 +226,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
       m_shutdown(false),
       m_server_grabs(0),
       m_randr_event_type(0),
-      m_RC_PATH("fluxbox"),
+      m_RC_PATH(realProgramName("fluxbox")),
       m_RC_INIT_FILE("init") {
 
     _FB_USES_NLS;
@@ -591,7 +591,7 @@ void Fluxbox::setupConfigFiles() {
 
     bool create_init = false, create_keys = false, create_menu = false;
 
-    string dirname = getenv("HOME") + string("/.") + string(m_RC_PATH) + "/";
+    string dirname = getenv("HOME") + string("/.") + m_RC_PATH + "/";
     string init_file, keys_file, menu_file, slitlist_file;
     init_file = dirname + m_RC_INIT_FILE;
     keys_file = dirname + "keys";
@@ -648,8 +648,8 @@ void Fluxbox::setupConfigFiles() {
     if (*config_version < CONFIG_VERSION) {
         // configs are out of date, so run fluxbox-update_configs
 
-        string commandargs = "fluxbox-update_configs -rc ";
-        commandargs += init_file;
+        string commandargs = realProgramName("fluxbox-update_configs");
+        commandargs += " -rc " + init_file;
 
 #ifdef HAVE_GETPID
         // add the fluxbox pid so fbuc can have us reload rc if necessary
@@ -1087,7 +1087,7 @@ void Fluxbox::handleSignal(int signum) {
         load_rc();
         break;
     case SIGUSR2:
-        reload_rc();
+        reconfigure();
         break;
     case SIGSEGV:
         abort();
@@ -1546,13 +1546,8 @@ void Fluxbox::load_rc(BScreen &screen) {
     }
 }
 
-void Fluxbox::reload_rc() {
-    load_rc();
-    reconfigure();
-}
-
-
 void Fluxbox::reconfigure() {
+    load_rc();
     m_reconfigure_wait = true;
     m_reconfig_timer.start();
 }
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index db6270e..2cd8ef3 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -216,7 +216,6 @@ private:
 
     std::string getRcFilename();
     void load_rc();
-    void reload_rc();
 
     void real_rereadMenu();
     void real_reconfigure();
@@ -305,7 +304,7 @@ private:
     int m_randr_event_type; ///< the type number of randr event
     int m_shape_eventbase; ///< event base for shape events
     bool m_have_shape; ///< if shape is supported by server
-    const char *m_RC_PATH;
+    std::string m_RC_PATH;
     const char *m_RC_INIT_FILE;
     Atom m_kwm1_dockwindow, m_kwm2_dockwindow;
 
diff --git a/util/Makefile.am b/util/Makefile.am
index 2033608..6c0adf6 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -41,6 +41,8 @@ startfluxbox: 	startfluxbox.in
 
 fluxbox-generate_menu: fluxbox-generate_menu.in
 		@regex_cmd@ -e "s,@PREFIX@,$(prefix),g" \
+		            -e "s,@pkgprefix@,$(PROGRAM_PREFIX:NONE=),g" \
+		            -e "s,@pkgsuffix@,$(PROGRAM_SUFFIX:NONE=),g" \
 				$(srcdir)/fluxbox-generate_menu.in \
 				> fluxbox-generate_menu
 		-chmod 755 fluxbox-generate_menu
diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in
index b98ea2a..1060724 100755
--- a/util/fluxbox-generate_menu.in
+++ b/util/fluxbox-generate_menu.in
@@ -61,7 +61,7 @@ fi
 # Functions
 display_usage() {
     cat << EOF
-Usage: fluxbox-generate_menu [-kgrBh] [-t terminal] [-w url] [-b browser]
+Usage: @pkgprefix@fluxbox-generate_menu@pkgsuffix@ [-kgrBh] [-t terminal] [-w url] [-b browser]
          [-m menu-title] [-o /path] [-u /path] [-p /path] [-n /path] [-q /path]
          [-d /path ] [-ds] [-i /path] [-is]
 EOF
@@ -89,8 +89,8 @@ Options:
     -w  Homepage for console-browsers. Default is fluxbox.org
     -b  Favourite browser
     -m  Menu-title; default is "Fluxbox"
-    -o  Outputfile; default is ~/.fluxbox/menu
-    -u  user sub-menu; default is ~/.fluxbox/usermenu
+    -o  Outputfile; default is ~/.@pkgprefix@fluxbox@pkgsuffix@/menu
+    -u  user sub-menu; default is ~/.@pkgprefix@fluxbox@pkgsuffix@/usermenu
 
     -h  Display this help
     -a  Display the authors of this script
@@ -103,8 +103,8 @@ Options:
 
 
 Files:
-    ~/.fluxbox/usermenu     your own submenu which will be included in the menu
-    ~/.fluxbox/menuconfig   rc file for fluxbox-generate_menu
+    ~/.@pkgprefix@fluxbox@pkgsuffix@/usermenu     your own submenu which will be included in the menu
+    ~/.@pkgprefix@fluxbox@pkgsuffix@/menuconfig   rc file for fluxbox-generate_menu
 
 EOF
 }
@@ -112,7 +112,7 @@ EOF
 display_authors() {
     cat << EOF
 
-fluxbox-generate_menu was brought to you by:
+@pkgprefix@fluxbox-generate_menu@pkgsuffix@ was brought to you by:
 
     Henrik Kinnunen:    Project leader.
     Han Boetes:         Packaging, debugging and scripts.
@@ -326,7 +326,7 @@ searchForIcon(){
 
     # convert icon file, if needed
     if [ -f "$entry_icon" ] && [ -n "yes$ConvertIfNecessary" ]; then
-        entry_icon=`convertIcon "$entry_icon" "$HOME/.fluxbox/icons"`
+        entry_icon=`convertIcon "$entry_icon" "$USERFLUXDIR/icons"`
         # $dnlamVERBOSE echo ":::: $entry_icon" >&2
     fi
 
@@ -1201,20 +1201,22 @@ case ${LC_ALL} in
 esac
 
 # Set Defaults
-MENUFILENAME="${MENUFILENAME:=${HOME}/.fluxbox/menu}"
+USERFLUXDIR="${HOME}/.@pkgprefix@fluxbox@pkgsuffix@"
+MENUFILENAME="${MENUFILENAME:=${USERFLUXDIR}/menu}"
 MENUTITLE="${MENUTITLE:=Fluxbox}"
 HOMEPAGE="${HOMEPAGE:=fluxbox.org}"
-USERMENU="${USERMENU:=${HOME}/.fluxbox/usermenu}"
+USERMENU="${USERMENU:=${USERFLUXDIR}/usermenu}"
+MENUCONFIG="${MENUCONFIG:=${USERFLUXDIR}/menuconfig}"
 
 # Read the menuconfig file if it exists or else create it.
 # But not during install time, use envvar for sun
 if [ ! "${INSTALL}" = Yes ]; then
-    if [ -r ${HOME}/.fluxbox/menuconfig ]; then
-        . ${HOME}/.fluxbox/menuconfig
+    if [ -r ${MENUCONFIG} ]; then
+        . ${MENUCONFIG}
     else
         if [ ! "$WHOAMI" = root ]; then # this is only for users.
-            if touch ${HOME}/.fluxbox/menuconfig; then
-                cat << EOF > ${HOME}/.fluxbox/menuconfig
+            if touch ${MENUCONFIG}; then
+                cat << EOF > ${MENUCONFIG}
 # This file is read by fluxbox-generate_menu.  If you don't like a
 # default you can change it here.  Don't forget to remove the # in front
 # of the line.
@@ -1228,7 +1230,7 @@ if [ ! "${INSTALL}" = Yes ]; then
 # MY_BROWSER=mozilla
 
 # Name of the outputfile
-# MENUFILENAME=${HOME}/.fluxbox/menu
+# MENUFILENAME=${USERFLUXDIR}/menu
 
 # MENUTITLE=\`fluxbox -version|cut -d " " -f-2\`
 
@@ -1236,7 +1238,7 @@ if [ ! "${INSTALL}" = Yes ]; then
 # HOMEPAGE=fluxbox.org
 
 # location with your own menu-entries
-# USERMENU=~/.fluxbox/usermenu
+# USERMENU=~/.@pkgprefix@fluxbox@pkgsuffix@/usermenu
 
 # Put the launcher you would like to use here
 # LAUNCHER=fbrun
@@ -1258,7 +1260,7 @@ if [ ! "${INSTALL}" = Yes ]; then
 
 
 # Sepparate the list of background-dirs with semicolumns ':'
-# BACKGROUND_DIRS="${HOME}/.fluxbox/backgrounds/:@PREFIX@/share/fluxbox/backgrounds/:/usr/share/wallpapers"
+# BACKGROUND_DIRS="${USERFLUXDIR}/backgrounds/:@PREFIX@/share/fluxbox/backgrounds/:/usr/share/wallpapers"
 
 
 # --- Boolean variables.
@@ -1279,7 +1281,7 @@ if [ ! "${INSTALL}" = Yes ]; then
 
 EOF
             else
-                echo "Warning: I couldn't create ${HOME}/.fluxbox/menuconfig" >&2
+                echo "Warning: I couldn't create ${MENUCONFIG}" >&2
             fi
         fi
     fi
@@ -1440,9 +1442,9 @@ done
 
 if [ -z "${INSTALL}" ] && [ -z "${NO_ICON}" ]; then
     # [ -z "$dnlamVERBOSE" ] && dnlamVERBOSE=": echo"   # for debugging
-    FB_ICONDIR="$HOME/.fluxbox/icons"
+    FB_ICONDIR="$USERFLUXDIR/icons"
     [ -r "$FB_ICONDIR" ] || mkdir "$FB_ICONDIR"
-    ICONMAPPING="$HOME/.fluxbox/iconmapping"
+    ICONMAPPING="$USERFLUXDIR/iconmapping"
 
     if [ "$GNOMEMENU" ] ; then
         OTHER_DESKTOP_PATHS="\"$HOME/.gnome/apps\" \"${GNOME_PREFIX}/share/gnome/apps\" $OTHER_DESKTOP_PATHS"
@@ -1483,7 +1485,7 @@ fi
 
 # directory for the backgrounds
 if [ -z "$BACKGROUND_DIRS" ]; then
-    BACKGROUND_DIRS="${HOME}/.fluxbox/backgrounds/:${PREFIX}/share/fluxbox/backgrounds/"
+    BACKGROUND_DIRS="${USERFLUXDIR}/backgrounds/:${PREFIX}/share/fluxbox/backgrounds/"
 fi
 
 # find the default terminal
@@ -1492,7 +1494,7 @@ if find_it_options $MY_TERM; then
 else
     [ -n "$MY_TERM" ] && echo "Warning: you chose an invalid term." >&2
     #The precise order is up for debate.
-    for term in Eterm urxvt urxvtc aterm rxvt wterm xterm konsole gnome-terminal; do
+    for term in Eterm urxvt urxvtc aterm mrxvt rxvt wterm konsole gnome-terminal xterm; do
         if find_it $term; then
             DEFAULT_TERM=$term
             break
@@ -1541,7 +1543,7 @@ cat << EOF > ${MENUFILENAME}
 # If you read this it means you want to edit this file manually, so here
 # are some useful tips:
 #
-# - You can add your own menu-entries to ~/.fluxbox/usermenu
+# - You can add your own menu-entries to ~/.@pkgprefix@fluxbox@pkgsuffix@/usermenu
 #
 # - If you miss apps please let me know and I will add them for the next
 #   release.
@@ -1550,8 +1552,8 @@ cat << EOF > ${MENUFILENAME}
 #   makes things much more readable.
 #
 # - To prevent any other app from overwriting your menu
-#   you can change the menu name in .fluxbox/init to:
-#     session.menuFile: /home/you/.fluxbox/my-menu
+#   you can change the menu name in .@pkgprefix@fluxbox@pkgsuffix@/init to:
+#     session.menuFile: ${USERFLUXDIR}/my-menu
 
 EOF
 
@@ -1806,7 +1808,7 @@ append_submenu "${FBSETTINGSMENU}"
     append_menu_end
 
     append_menu "[submenu] (${USERSTYLES}) {${STYLEMENUTITLE}}"
-        append "[stylesdir] (~/.fluxbox/styles)"
+        append "[stylesdir] (~/.@pkgprefix@fluxbox@pkgsuffix@/styles)"
     append_menu_end
 
     # Backgroundmenu
@@ -1820,7 +1822,7 @@ append_submenu "${FBSETTINGSMENU}"
         NUMBER_OF_BACKGROUNDS=`find $BACKGROUND_DIRS -follow -type f 2> /dev/null|wc -l`
         if [ "$NUMBER_OF_BACKGROUNDS" -gt 0 ]; then
             append_menu "[submenu] (${BACKGROUNDMENU}) {${BACKGROUNDMENUTITLE}}"
-            append "[exec] (${RANDOMBACKGROUND}) {fbsetbg -r ${HOME}/.fluxbox/backgrounds}"
+            append "[exec] (${RANDOMBACKGROUND}) {fbsetbg -r ${USERFLUXDIR}/backgrounds}"
             if [ "$NUMBER_OF_BACKGROUNDS" -gt 30 ]; then
                 menucounter=1 ; counter=1
                 append_menu "[submenu] (${BACKGROUNDMENU} $menucounter) {${BACKGROUNDMENUTITLE}}"
@@ -1862,7 +1864,7 @@ append_submenu "${FBSETTINGSMENU}"
         find_it ${LAUNCHER} append "[exec] (${RUNCOMMAND}) {${LAUNCHER} $FBRUNOPTIONS}"
         find_it switch append "[exec] (gtk-theme-switch) {switch}"
         find_it switch2 append "[exec] (gtk2-theme-switch) {switch2}"
-        find_it fluxbox-generate_menu append "[exec] (${REGENERATEMENU}) {fluxbox-generate_menu ${BACKUPOPTIONS}}"
+        find_it $0 append "[exec] (${REGENERATEMENU}) {$0 ${BACKUPOPTIONS}}"
     append_menu_end
 
     append_submenu "${WINDOWMANAGERS}"
@@ -1908,13 +1910,13 @@ mv -f menu.tmp $MENUFILENAME
 
 if [ -z "$INSTALL" ]; then
     if [ -z "$CHECKINIT" ]; then
-        INITMENUFILENAME=`awk '/menuFile/ {print $2}' $HOME/.fluxbox/init`
+        INITMENUFILENAME=`awk '/menuFile/ {print $2}' $USERFLUXDIR/init`
         INITMENUFILENAME=`replaceWithinString "$INITMENUFILENAME" "~" "$HOME"`
         if [ ! "$INITMENUFILENAME" = "$MENUFILENAME" ]; then 
-            echo "Note: In $HOME/.fluxbox/init, your \"session.menuFile\" does not point to $MENUFILENAME but to $INITMENUFILENAME" >&2
+            echo "Note: In $USERFLUXDIR/init, your \"session.menuFile\" does not point to $MENUFILENAME but to $INITMENUFILENAME" >&2
         fi
     fi
     echo "Menu successfully generated: $MENUFILENAME"
     #echo "  Make sure \"session.menuFile: $MENUFILENAME\" is in $HOME/.fluxbox/init."
-    echo 'Use fluxbox-generate_menu -h to read about all the latest features.'
+    echo 'Use @pkgprefix@fluxbox-generate_menu@pkgsuffix@ -h to read about all the latest features.'
 fi
diff --git a/util/startfluxbox.in b/util/startfluxbox.in
index 8575555..fee1203 100755
--- a/util/startfluxbox.in
+++ b/util/startfluxbox.in
@@ -2,7 +2,8 @@
 # $Id$
 
 command="`basename \"$0\"`"
-startup="$HOME/.fluxbox/startup"
+fluxdir="$HOME/.@pkgprefix@fluxbox@pkgsuffix@"
+startup="$fluxdir/startup"
 
 while [ $# -gt 0 ]; do
     case "$1" in
@@ -28,8 +29,8 @@ if [ -x "$startup" ]; then
 elif [ -r "$startup" ]; then
     exec sh "$startup"
 else
-    if [ ! -d "$HOME/.fluxbox" ]; then
-        mkdir -p "$HOME/.fluxbox/backgrounds" "$HOME/.fluxbox/styles" "$HOME/.fluxbox/pixmaps"
+    if [ ! -d $fluxdir ]; then
+        mkdir -p "$fluxdir/backgrounds" "$fluxdir/styles" "$fluxdir/pixmaps"
     fi
     if [ ! -r "$startup" ]; then
         ( cat << EOF
@@ -81,7 +82,7 @@ else
 
 exec @pkgbindir@/@pkgprefix@fluxbox@pkgsuffix@
 # or if you want to keep a log:
-# exec @pkgbindir@/@pkgprefix@fluxbox@pkgsuffix@ -log "$HOME/.fluxbox/log"
+# exec @pkgbindir@/@pkgprefix@fluxbox@pkgsuffix@ -log "$fluxdir/log"
 EOF
     ) > "$startup"
     fi
-- 
cgit v0.11.2