diff options
Diffstat (limited to '')
-rw-r--r-- | calmwm.h | 6 | ||||
-rw-r--r-- | conf.c | 6 | ||||
-rw-r--r-- | cwm.1 | 8 | ||||
-rw-r--r-- | kbfunc.c | 31 | ||||
-rw-r--r-- | util.c | 18 |
5 files changed, 61 insertions, 8 deletions
@@ -4,7 +4,7 @@ * Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org> * All rights reserved. * - * $Id: calmwm.h,v 1.12 2007/11/19 22:18:16 oga Exp $ + * $Id: calmwm.h,v 1.13 2007/11/28 16:35:52 ian Exp $ */ #ifndef _CALMWM_H_ @@ -209,6 +209,10 @@ enum directions { CWM_UP=0, CWM_DOWN, CWM_LEFT, CWM_RIGHT, }; +/* for cwm_exec */ +#define CWM_EXEC_PROGRAM 0x1 +#define CWM_EXEC_WM 0x2 + #define KBFLAG_NEEDCLIENT 0x01 #define KBFLAG_FINDCLIENT 0x02 @@ -4,7 +4,7 @@ * Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org> * All rights reserved. * - * $Id: conf.c,v 1.15 2007/11/28 16:02:37 oga Exp $ + * $Id: conf.c,v 1.16 2007/11/28 16:35:52 ian Exp $ */ #include "headers.h" @@ -185,6 +185,7 @@ conf_setup(struct conf *c) conf_bindname(c, "CM-Return", "terminal"); conf_bindname(c, "CM-Delete", "lock"); conf_bindname(c, "M-question", "exec"); + conf_bindname(c, "CM-q", "exec_wm"); conf_bindname(c, "M-period", "ssh"); conf_bindname(c, "M-Return", "hide"); conf_bindname(c, "M-Down", "lower"); @@ -373,7 +374,8 @@ struct { { "prevgroup", kbfunc_client_prevgroup, 0, 0 }, { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 }, { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 }, - { "exec", kbfunc_exec, 0, 0 }, + { "exec", kbfunc_exec, 0, CWM_EXEC_PROGRAM }, + { "exec_wm", kbfunc_exec, 0, CWM_EXEC_WM }, { "ssh", kbfunc_ssh, 0, 0 }, { "terminal", kbfunc_term, 0, 0 }, { "lock", kbfunc_lock, 0, 0 }, @@ -1,4 +1,4 @@ -.\" $OpenBSD: cwm.1,v 1.16 2007/11/19 22:18:16 oga Exp $ +.\" $OpenBSD: cwm.1,v 1.17 2007/11/28 16:35:52 ian Exp $ .\" .\" The following requests are required for all man pages. .Dd June 29, 2007 @@ -98,6 +98,12 @@ This parses to provide host auto-completion. .Xr ssh 1 will be executed via the configured terminal emulator. +.It Ic CM-q +Spawn +.Dq Exec WindowManager +dialog; allows you to switch from +.Nm +to another window manager without restarting the X server. .El .Pp The mouse bindings are also important, they are: @@ -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); @@ -4,7 +4,7 @@ * Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org> * All rights reserved. * - * $Id: util.c,v 1.1.1.1 2007/04/27 17:58:48 bernd Exp $ + * $Id: util.c,v 1.2 2007/11/28 16:35:52 ian Exp $ */ #include "headers.h" @@ -39,6 +39,22 @@ u_spawn(char *argstr) return (0); } +void +exec_wm(char *argstr) +{ + char *args[MAXARGLEN], **ap = args; + char **end = &args[MAXARGLEN - 1]; + + while (ap < end && (*ap = strsep(&argstr, " \t")) != NULL) + ap++; + + *ap = NULL; + setsid(); + execvp(args[0], args); + err(1, args[0]); +} + + int dirent_exists(char *filename) { struct stat buffer; |