From 2301968bd96aa9406bf8dab008a5d9e313570ddb Mon Sep 17 00:00:00 2001
From: Mark Tiefenbruck <mark@fluxbox.org>
Date: Fri, 25 Apr 2008 01:36:26 -0700
Subject: add fbrun to default apps file

---
 configure.in     |  8 ++++++++
 data/Makefile.am | 17 +++++++++++++----
 src/Makefile.am  |  2 ++
 src/fluxbox.cc   | 12 ++++++++++--
 4 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/configure.in b/configure.in
index c58f0fc..5744b6c 100644
--- a/configure.in
+++ b/configure.in
@@ -554,6 +554,14 @@ AC_ARG_WITH(
 AC_SUBST(DEFAULT_KEYS)
 
 AC_ARG_WITH(
+  apps,
+  [ --with-apps=path         location apps file (PREFIX/share/fluxbox/apps)],
+  DEFAULT_APPS=$with_apps,
+  DEFAULT_APPS=\$\(prefix\)/share/fluxbox/apps
+)
+AC_SUBST(DEFAULT_APPS)
+
+AC_ARG_WITH(
   init,
   [  --with-init=path        location init file (PREFIX/share/fluxbox/init)],
   DEFAULT_INIT=$with_init,
diff --git a/data/Makefile.am b/data/Makefile.am
index 80fed6a..4a0bd10 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -6,14 +6,15 @@ PROGRAM_SUFFIX=@program_suffix@
 DEFAULT_MENU = @DEFAULT_MENU@
 DEFAULT_STYLE = @DEFAULT_STYLE@
 DEFAULT_KEYS = @DEFAULT_KEYS@
+DEFAULT_APPS = @DEFAULT_APPS@
 DEFAULT_INIT = @DEFAULT_INIT@
 
 SUBDIRS= 		styles
-CLEANFILES= 		menu menu.in menu.pre menu.bak init
+CLEANFILES= 		menu menu.in menu.pre menu.bak init apps
 MAINTAINERCLEANFILES= 	Makefile.in
-pkgdata_DATA= 		keys menu init
-EXTRA_DIST= 		keys init.in
-all-local: 		menu init
+pkgdata_DATA= 		keys menu init apps
+EXTRA_DIST= 		keys init.in apps.in
+all-local: 		menu init apps
 install-pkgdataDATA:
 	@echo "Installing menu file in $(DESTDIR)$(DEFAULT_MENU)"
 	$(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_MENU))
@@ -21,6 +22,9 @@ install-pkgdataDATA:
 	@echo "Installing keys file in $(DESTDIR)$(DEFAULT_KEYS)"
 	$(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_KEYS))
 	$(INSTALL_DATA) $(srcdir)/keys $(DESTDIR)$(DEFAULT_KEYS)
+	@echo "Installing apps file in $(DESTDIR)$(DEFAULT_APPS)"
+	$(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_APPS))
+	$(INSTALL_DATA) $(srcdir)/apps $(DESTDIR)$(DEFAULT_APPS)
 	@echo "Installing init file in $(DESTDIR)$(DEFAULT_INIT)"
 	$(mkinstalldirs) $(DESTDIR)$(dir $(DEFAULT_INIT))
 	$(INSTALL_DATA) init $(DESTDIR)$(DEFAULT_INIT)
@@ -33,6 +37,11 @@ init: 			init.in
 			-e "s,@pkgsuffix@,$(PROGRAM_SUFFIX:NONE=),g" \
 			-e "s,@default_style@,$(DEFAULT_STYLE),g" $(srcdir)/init.in > init
 
+apps: 			apps.in
+	@regex_cmd@ -e "s,@pkgdatadir@,$(pkgdatadir),g" \
+			-e "s,@pkgprefix@,$(PROGRAM_PREFIX:NONE=),g" \
+			-e "s,@pkgsuffix@,$(PROGRAM_SUFFIX:NONE=),g" $(srcdir)/apps.in > apps
+
 menu: 			../util/fluxbox-generate_menu
 	env	MENUFILENAME=menu \
 		PREFIX="${prefix}" \
diff --git a/src/Makefile.am b/src/Makefile.am
index 1d489c1..8fe65a6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,6 +27,7 @@ SUBDIRS= FbTk
 DEFAULT_MENU=@DEFAULT_MENU@
 DEFAULT_STYLE=@DEFAULT_STYLE@
 DEFAULT_KEYSFILE=@DEFAULT_KEYS@
+DEFAULT_APPSFILE=@DEFAULT_APPS@
 DEFAULT_INITFILE=@DEFAULT_INIT@
 PROGRAM_PREFIX=@program_prefix@
 PROGRAM_SUFFIX=@program_suffix@
@@ -44,6 +45,7 @@ defaults.hh: Makefile
 		echo '#define DEFAULTMENU "$(DEFAULT_MENU)"'; \
 		echo '#define DEFAULTSTYLE "$(DEFAULT_STYLE)"'; \
 		echo '#define DEFAULTKEYSFILE "$(DEFAULT_KEYSFILE)"'; \
+		echo '#define DEFAULT_APPSFILE "$(DEFAULT_APPSFILE)"'; \
 		echo '#define DEFAULT_INITFILE "$(DEFAULT_INITFILE)"'; \
 		echo '#define PROGRAM_PREFIX "$(PROGRAM_PREFIX:NONE=)"'; \
 		echo '#define PROGRAM_SUFFIX "$(PROGRAM_SUFFIX:NONE=)"'; \
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index a1896e9..1045430 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -523,13 +523,15 @@ void Fluxbox::ungrab() {
 */
 void Fluxbox::setupConfigFiles() {
 
-    bool create_init = false, create_keys = false, create_menu = false;
+    bool create_init = false, create_keys = false, create_menu = false,
+         create_apps = false;
 
     string dirname = getenv("HOME") + string("/.") + m_RC_PATH + "/";
-    string init_file, keys_file, menu_file, slitlist_file;
+    string init_file, keys_file, menu_file, slitlist_file, apps_file;
     init_file = dirname + m_RC_INIT_FILE;
     keys_file = dirname + "keys";
     menu_file = dirname + "menu";
+    apps_file = dirname + "apps";
 
     struct stat buf;
 
@@ -543,6 +545,8 @@ void Fluxbox::setupConfigFiles() {
             create_keys = true;
         if (stat(menu_file.c_str(), &buf))
             create_menu = true;
+        if (stat(apps_file.c_str(), &buf))
+            create_apps = true;
 
     } else {
 #ifdef DEBUG
@@ -572,6 +576,10 @@ void Fluxbox::setupConfigFiles() {
     if (create_menu)
         FbTk::FileUtil::copyFile(DEFAULTMENU, menu_file.c_str());
 
+    // copy apps file
+    if (create_apps)
+        FbTk::FileUtil::copyFile(DEFAULT_APPSFILE, apps_file.c_str());
+
     // copy init file
     if (create_init)
         FbTk::FileUtil::copyFile(DEFAULT_INITFILE, init_file.c_str());
-- 
cgit v0.11.2