diff options
author | ian | 2007-11-28 16:35:52 +0000 |
---|---|---|
committer | ian | 2007-11-28 16:35:52 +0000 |
commit | 39193ce4f0d99ad8f16707e00590cb0831c3b2ea (patch) | |
tree | 539855d794aea6a6c341d16825df3c4be2d2d8cf /kbfunc.c | |
parent | 7f9f575b0ac9765c51c4ac7f61c23660576a5e22 (diff) | |
download | cwm-39193ce4f0d99ad8f16707e00590cb0831c3b2ea.tar.gz |
Add a "restart wm" function. ok oga@
Diffstat (limited to 'kbfunc.c')
-rw-r--r-- | kbfunc.c | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -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); |