aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calmwm.h8
-rw-r--r--conf.c23
-rw-r--r--cwm.19
-rw-r--r--kbfunc.c42
4 files changed, 78 insertions, 4 deletions
diff --git a/calmwm.h b/calmwm.h
index 5a47cb9..7d15b82 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -4,7 +4,7 @@
* Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org>
* All rights reserved.
*
- * $Id: calmwm.h,v 1.7 2007/06/26 19:34:26 niallo Exp $
+ * $Id: calmwm.h,v 1.8 2007/06/27 13:28:22 todd Exp $
*/
#ifndef _CALMWM_H_
@@ -204,6 +204,11 @@ enum kbtype {
KB__LAST
};
+#define CWM_BIGMOVE 0x1000
+enum directions {
+ CWM_UP=0, CWM_DOWN, CWM_LEFT, CWM_RIGHT,
+};
+
#define KBFLAG_NEEDCLIENT 0x01
#define KBFLAG_FINDCLIENT 0x02
@@ -426,6 +431,7 @@ void kbfunc_client_prevgroup(struct client_ctx *, void *);
void kbfunc_client_nogroup(struct client_ctx *, void *);
void kbfunc_client_maximize(struct client_ctx *, void *);
void kbfunc_client_vmaximize(struct client_ctx *, void *);
+void kbfunc_client_move(struct client_ctx *, void *);
void kbfunc_menu_search(struct client_ctx *, void *);
void kbfunc_exec(struct client_ctx *, void *);
void kbfunc_ssh(struct client_ctx *, void *);
diff --git a/conf.c b/conf.c
index 4b96323..05bc9d2 100644
--- a/conf.c
+++ b/conf.c
@@ -4,7 +4,7 @@
* Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org>
* All rights reserved.
*
- * $Id: conf.c,v 1.7 2007/06/26 19:34:26 niallo Exp $
+ * $Id: conf.c,v 1.8 2007/06/27 13:28:22 todd Exp $
*/
#include "headers.h"
@@ -20,6 +20,7 @@
#define CONF_MAX_WINTITLE 256
#define CONF_IGNORECASE 0x01
+
/*
* Match a window.
*/
@@ -237,6 +238,26 @@ conf_setup(struct conf *c)
XK_f, ControlMask|Mod1Mask, KBFLAG_NEEDCLIENT, 0);
conf_bindkey(c, kbfunc_client_vmaximize,
XK_equal, ControlMask|Mod1Mask, KBFLAG_NEEDCLIENT, 0);
+ conf_bindkey(c, kbfunc_client_move,
+ XK_k, Mod1Mask, KBFLAG_NEEDCLIENT, (void *)CWM_UP);
+ conf_bindkey(c, kbfunc_client_move,
+ XK_j, Mod1Mask, KBFLAG_NEEDCLIENT, (void *)CWM_DOWN);
+ conf_bindkey(c, kbfunc_client_move,
+ XK_l, Mod1Mask, KBFLAG_NEEDCLIENT, (void *)CWM_RIGHT);
+ conf_bindkey(c, kbfunc_client_move,
+ XK_h, Mod1Mask, KBFLAG_NEEDCLIENT, (void *)CWM_LEFT);
+ conf_bindkey(c, kbfunc_client_move,
+ XK_K, Mod1Mask, KBFLAG_NEEDCLIENT,
+ (void *)(CWM_UP|CWM_BIGMOVE));
+ conf_bindkey(c, kbfunc_client_move,
+ XK_J, Mod1Mask, KBFLAG_NEEDCLIENT,
+ (void *)(CWM_DOWN|CWM_BIGMOVE));
+ conf_bindkey(c, kbfunc_client_move,
+ XK_L, Mod1Mask, KBFLAG_NEEDCLIENT,
+ (void *)(CWM_RIGHT|CWM_BIGMOVE));
+ conf_bindkey(c, kbfunc_client_move,
+ XK_H, Mod1Mask, KBFLAG_NEEDCLIENT,
+ (void *)(CWM_LEFT|CWM_BIGMOVE));
}
snprintf(dir_settings, sizeof(dir_settings),
diff --git a/cwm.1 b/cwm.1
index 540ec7f..17b8762 100644
--- a/cwm.1
+++ b/cwm.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwm.1,v 1.7 2007/06/26 19:34:26 niallo Exp $
+.\" $OpenBSD: cwm.1,v 1.8 2007/06/27 13:28:22 todd Exp $
.\"
.\" The following requests are required for all man pages.
.Dd July 10, 2004
@@ -126,6 +126,13 @@ font string
.Ar fontname
the default font.
.El
+.Sh WINDOW MOVEMENT
+.Nm
+windows can be moved with the use of the keyboard through Vi-like bindings.
+M-[hjkl] moves the current window a small amount, while M-shift-[hjkl] moves
+the current window a larger amount.
+For example, to move the current window to the left a small amount, press M-h.
+To move the current window down by a larger amount, press M-shift-j.
.Sh SEARCH
.Nm
features the ability to search for windows by their current title, old
diff --git a/kbfunc.c b/kbfunc.c
index a206320..adb4d82 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.5 2007/06/26 19:34:26 niallo Exp $
+ * $Id: kbfunc.c,v 1.6 2007/06/27 13:28:22 todd Exp $
*/
#include <paths.h>
@@ -14,6 +14,7 @@
#define KNOWN_HOSTS ".ssh/known_hosts"
#define HASH_MARKER "|1|"
+#define MOVE_AMOUNT 10
void
kbfunc_client_lower(struct client_ctx *cc, void *arg)
@@ -28,6 +29,45 @@ kbfunc_client_raise(struct client_ctx *cc, void *arg)
}
void
+kbfunc_client_move(struct client_ctx *cc, void *arg)
+{
+ int x,y,flags,amt;
+ u_int mx,my;
+
+ mx = my = 0;
+
+ flags = (int)arg;
+ amt = MOVE_AMOUNT;
+
+ if (flags & CWM_BIGMOVE) {
+ flags -= CWM_BIGMOVE;
+ amt = amt*10;
+ }
+
+ switch(flags) {
+ case CWM_UP:
+ my -= amt;
+ break;
+ case CWM_DOWN:
+ my += amt;
+ break;
+ case CWM_RIGHT:
+ mx += amt;
+ break;
+ case CWM_LEFT:
+ mx -= amt;
+ break;
+ }
+
+ cc->geom.y += my;
+ cc->geom.x += mx;
+ client_move(cc);
+ xu_ptr_getpos(cc->pwin, &x, &y);
+ cc->ptr.y = y + my;
+ cc->ptr.x = x + mx;
+ client_ptrwarp(cc);
+}
+void
kbfunc_client_search(struct client_ctx *scratch, void *arg)
{
struct menu_q menuq;