From 39193ce4f0d99ad8f16707e00590cb0831c3b2ea Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 28 Nov 2007 16:35:52 +0000 Subject: Add a "restart wm" function. ok oga@ --- kbfunc.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'kbfunc.c') 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 * 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 @@ -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); -- cgit v1.2.3-2-gb3c3