aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h8
-rw-r--r--monsterwm.c11
2 files changed, 19 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h
index 13edf65..8f2ba88 100644
--- a/config.def.h
+++ b/config.def.h
@@ -53,6 +53,14 @@ static key keys[] = {
{ MOD1|SHIFT, XK_g, switch_mode, {.i = GRID}},
{ MOD1|CONTROL, XK_q, quit, {NULL}},
{ MOD1|SHIFT, XK_Return, spawn, {.com = termcmd}},
+ { MOD4, XK_Down, moveresize, {.v = (int []){ 0, 25, 0, 0 }}}, /* move up */
+ { MOD4, XK_Up, moveresize, {.v = (int []){ 0, -25, 0, 0 }}}, /* move down */
+ { MOD4, XK_Right, moveresize, {.v = (int []){ 25, 0, 0, 0 }}}, /* move right */
+ { MOD4, XK_Left, moveresize, {.v = (int []){ -25, 0, 0, 0 }}}, /* move left */
+ { MOD4|SHIFT, XK_Down, moveresize, {.v = (int []){ 0, 0, 0, 25 }}}, /* height grow */
+ { MOD4|SHIFT, XK_Up, moveresize, {.v = (int []){ 0, 0, 0, -25 }}}, /* height shrink */
+ { MOD4|SHIFT, XK_Right, moveresize, {.v = (int []){ 0, 0, 25, 0 }}}, /* width grow */
+ { MOD4|SHIFT, XK_Left, moveresize, {.v = (int []){ 0, 0, -25, 0 }}}, /* width shrink */
DESKTOPCHANGE( XK_F1, 0)
DESKTOPCHANGE( XK_F2, 1)
DESKTOPCHANGE( XK_F3, 2)
diff --git a/monsterwm.c b/monsterwm.c
index 171bde4..6fbdc80 100644
--- a/monsterwm.c
+++ b/monsterwm.c
@@ -31,6 +31,7 @@ enum { NET_SUPPORTED, NET_FULLSCREEN, NET_WM_STATE, NET_ACTIVE, NET_COUNT };
typedef union {
const char** com;
const int i;
+ const void *v;
} Arg;
/* a key struct represents a combination of
@@ -122,6 +123,7 @@ static void maprequest(XEvent *e);
static void monocle(int h, int y);
static void move_down();
static void move_up();
+static void moveresize(const Arg *arg);
static void mousemotion(const Arg *arg);
static void next_win();
static client* prev_client(client *c);
@@ -583,6 +585,15 @@ void move_up(void) {
tile();
}
+/* move and resize a window with the keyboard */
+void moveresize(const Arg *arg) {
+ XWindowAttributes wa;
+ if (!current || !XGetWindowAttributes(dis, current->win, &wa)) return;
+ if (!current->isfloating) { current->isfloating = True; tile(); }
+ XMoveResizeWindow(dis, current->win, wa.x + ((int *)arg->v)[0], wa.y + ((int *)arg->v)[1],
+ wa.width + ((int *)arg->v)[2], wa.height + ((int *)arg->v)[3]);
+}
+
/* cyclic focus the next window
* if the window is the last on stack, focus head */
void next_win(void) {