aboutsummaryrefslogtreecommitdiffstats
path: root/kbfunc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kbfunc.c')
-rw-r--r--kbfunc.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/kbfunc.c b/kbfunc.c
index b748f60..d14f874 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -4,7 +4,7 @@
* Copyright (c) 2004 Martin Murray <mmurray@monkey.org>
* All rights reserved.
*
- * $Id: kbfunc.c,v 1.10 2007/11/13 23:08:49 todd Exp $
+ * $Id: kbfunc.c,v 1.11 2007/11/28 16:35:52 ian Exp $
*/
#include <paths.h>
@@ -263,6 +263,20 @@ kbfunc_exec(struct client_ctx *scratch, void *arg)
struct stat sb;
struct menu_q menuq;
struct menu *mi;
+ char *label;
+
+ int cmd = (int)arg;
+ switch(cmd) {
+ case CWM_EXEC_PROGRAM:
+ label = "exec";
+ break;
+ case CWM_EXEC_WM:
+ label = "wm";
+ break;
+ default:
+ err(1, "kbfunc_exec: invalid cmd %d", cmd);
+ /*NOTREACHED*/
+ }
if (getgroups(0, mygroups) == -1)
err(1, "getgroups failure");
@@ -320,8 +334,19 @@ kbfunc_exec(struct client_ctx *scratch, void *arg)
}
if ((mi = search_start(&menuq,
- search_match_exec, NULL, NULL, "exec", 1)) != NULL)
- u_spawn(mi->text);
+ search_match_exec, NULL, NULL, label, 1)) != NULL) {
+ switch (cmd) {
+ case CWM_EXEC_PROGRAM:
+ u_spawn(mi->text);
+ break;
+ case CWM_EXEC_WM:
+ exec_wm(mi->text);
+ break;
+ default:
+ err(1, "kb_func: egad, cmd changed value!");
+ break;
+ }
+ }
if (mi != NULL && mi->dummy)
xfree(mi);