Add quit function, bind it per default to CM-q and change exec_wm

binding to CM-w.

Inital diff from Gleydson Soares
Feedback from oga@ and okan@

ok oga@
This commit is contained in:
simon 2008-04-07 23:47:09 +00:00
parent cb2cc70c3f
commit 0f18223042
5 changed files with 18 additions and 4 deletions

View File

@ -451,6 +451,7 @@ void kbfunc_client_prevgroup(struct client_ctx *, void *);
void kbfunc_client_nogroup(struct client_ctx *, void *); void kbfunc_client_nogroup(struct client_ctx *, void *);
void kbfunc_client_maximize(struct client_ctx *, void *); void kbfunc_client_maximize(struct client_ctx *, void *);
void kbfunc_client_vmaximize(struct client_ctx *, void *); void kbfunc_client_vmaximize(struct client_ctx *, void *);
void kbfunc_quit_wm(struct client_ctx *, void *);
void kbfunc_client_move(struct client_ctx *, void *); void kbfunc_client_move(struct client_ctx *, void *);
void kbfunc_client_resize(struct client_ctx *, void *); void kbfunc_client_resize(struct client_ctx *, void *);
void kbfunc_menu_search(struct client_ctx *, void *); void kbfunc_menu_search(struct client_ctx *, void *);

4
conf.c
View File

@ -94,7 +94,7 @@ conf_init(struct conf *c)
conf_bindname(c, "CM-Return", "terminal"); conf_bindname(c, "CM-Return", "terminal");
conf_bindname(c, "CM-Delete", "lock"); conf_bindname(c, "CM-Delete", "lock");
conf_bindname(c, "M-question", "exec"); conf_bindname(c, "M-question", "exec");
conf_bindname(c, "CM-q", "exec_wm"); conf_bindname(c, "CM-w", "exec_wm");
conf_bindname(c, "M-period", "ssh"); conf_bindname(c, "M-period", "ssh");
conf_bindname(c, "M-Return", "hide"); conf_bindname(c, "M-Return", "hide");
conf_bindname(c, "M-Down", "lower"); conf_bindname(c, "M-Down", "lower");
@ -119,6 +119,7 @@ conf_init(struct conf *c)
conf_bindname(c, "M-Left", "prevgroup"); conf_bindname(c, "M-Left", "prevgroup");
conf_bindname(c, "CM-f", "maximize"); conf_bindname(c, "CM-f", "maximize");
conf_bindname(c, "CM-equal", "vmaximize"); conf_bindname(c, "CM-equal", "vmaximize");
conf_bindname(c, "CM-q", "quit");
conf_bindname(c, "M-h", "moveleft"); conf_bindname(c, "M-h", "moveleft");
conf_bindname(c, "M-j", "movedown"); conf_bindname(c, "M-j", "movedown");
@ -260,6 +261,7 @@ struct {
{ "prevgroup", kbfunc_client_prevgroup, 0, 0 }, { "prevgroup", kbfunc_client_prevgroup, 0, 0 },
{ "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 }, { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 }, { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
{ "quit", kbfunc_quit_wm, 0, 0 },
{ "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM }, { "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM },
{ "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM }, { "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM },
{ "ssh", kbfunc_ssh, 0, 0 }, { "ssh", kbfunc_ssh, 0, 0 },

6
cwm.1
View File

@ -15,7 +15,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.\" The following requests are required for all man pages. .\" The following requests are required for all man pages.
.Dd $Mdocdate$ .Dd $Mdocdate: March 23 2008 $
.Dt CWM 1 .Dt CWM 1
.Os .Os
.Sh NAME .Sh NAME
@ -61,6 +61,8 @@ their functionality is described in more detail later.
Spawn a new terminal. Spawn a new terminal.
.It Ic C-M-Delete .It Ic C-M-Delete
Lock the screen. Lock the screen.
.It Ic C-M-q
Quit cwm.
.It Ic M-Enter .It Ic M-Enter
Hide current window. Hide current window.
.It Ic M-Down .It Ic M-Down
@ -104,7 +106,7 @@ This parses
to provide host auto-completion. to provide host auto-completion.
.Xr ssh 1 .Xr ssh 1
will be executed via the configured terminal emulator. will be executed via the configured terminal emulator.
.It Ic C-M-q .It Ic C-M-w
Spawn Spawn
.Dq Exec WindowManager .Dq Exec WindowManager
dialog; allows you to switch from dialog; allows you to switch from

View File

@ -27,6 +27,8 @@
#define HASH_MARKER "|1|" #define HASH_MARKER "|1|"
#define MOVE_AMOUNT 1 #define MOVE_AMOUNT 1
extern int _xev_quit;
void void
kbfunc_client_lower(struct client_ctx *cc, void *arg) kbfunc_client_lower(struct client_ctx *cc, void *arg)
{ {
@ -488,3 +490,9 @@ kbfunc_client_vmaximize(struct client_ctx *cc, void *arg)
{ {
client_vertmaximize(cc); client_vertmaximize(cc);
} }
void
kbfunc_quit_wm(struct client_ctx *cc, void *arg)
{
_xev_quit = 1;
}

View File

@ -451,6 +451,7 @@ out:
static struct xevent_q _xevq, _xevq_putaway; static struct xevent_q _xevq, _xevq_putaway;
static short _xev_q_lock = 0; static short _xev_q_lock = 0;
int _xev_quit = 0;
void void
xev_init(void) xev_init(void)
@ -524,7 +525,7 @@ xev_loop(void)
XEvent e; XEvent e;
struct xevent *xev, *nextxev; struct xevent *xev, *nextxev;
for (;;) { while (_xev_quit == 0) {
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
if (TAILQ_EMPTY(&_xevq)) if (TAILQ_EMPTY(&_xevq))
errx(1, "X event queue empty"); errx(1, "X event queue empty");