Hi everyone, This is my first attempt at hacking cwm. This feature allows one to move the current window to the corners of the screen.
IIRC, evilwm used to have this feature. Not sure if it is upstream material though. I am also not so sure about the default keybinds, let me know if you have any ideas. =================================================================== RCS file: /cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.259 diff -u -p -r1.259 calmwm.h --- calmwm.h 8 Feb 2014 02:49:30 -0000 1.259 +++ calmwm.h 22 Jun 2014 14:27:26 -0000 @@ -60,6 +60,10 @@ #define CWM_DOWN 0x0020 #define CWM_LEFT 0x0040 #define CWM_RIGHT 0x0080 +#define CWM_TOP_LEFT 0x0100 +#define CWM_BOTTOM_LEFT 0x0200 +#define CWM_TOP_RIGHT 0x0400 +#define CWM_BOTTOM_RIGHT 0x0800 /* exec */ #define CWM_EXEC_PROGRAM 0x0001 @@ -478,7 +482,8 @@ void kbfunc_menu_cmd(struct client_ct void kbfunc_ssh(struct client_ctx *, union arg *); void kbfunc_term(struct client_ctx *, union arg *); void kbfunc_tile(struct client_ctx *, union arg *); - +void kbfunc_client_move_edge(struct client_ctx *, + union arg *); void mousefunc_client_grouptoggle(struct client_ctx *, union arg *); void mousefunc_client_move(struct client_ctx *, Index: conf.c =================================================================== RCS file: /cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.173 diff -u -p -r1.173 conf.c --- conf.c 21 Apr 2014 12:52:14 -0000 1.173 +++ conf.c 22 Jun 2014 14:27:26 -0000 @@ -233,6 +233,10 @@ static const struct { { "CS-Down", "bigptrmovedown" }, { "CS-Up", "bigptrmoveup" }, { "CS-Right", "bigptrmoveright" }, + { "CM-t", "movetopleft" }, + { "CM-v", "movebottomleft" }, + { "CM-y", "movetopright" }, + { "CM-b", "movebottomright" }, }, mouse_binds[] = { { "1", "menu_unhide" }, @@ -453,6 +457,14 @@ static const struct { {.i = (CWM_RIGHT|CWM_PTRMOVE|CWM_BIGMOVE)} }, { "htile", kbfunc_tile, CWM_WIN, {.i = CWM_TILE_HORIZ} }, { "vtile", kbfunc_tile, CWM_WIN, {.i = CWM_TILE_VERT} }, + { "movetopleft", kbfunc_client_move_edge, CWM_WIN, + {.i = (CWM_TOP_LEFT)} }, + { "movebottomleft", kbfunc_client_move_edge, CWM_WIN, + {.i = (CWM_BOTTOM_LEFT)} }, + { "movetopright", kbfunc_client_move_edge, CWM_WIN, + {.i = (CWM_TOP_RIGHT)} }, + { "movebottomright", kbfunc_client_move_edge, CWM_WIN, + {.i = (CWM_BOTTOM_RIGHT)} }, }; static const struct { Index: cwm.1 =================================================================== RCS file: /cvs/xenocara/app/cwm/cwm.1,v retrieving revision 1.50 diff -u -p -r1.50 cwm.1 --- cwm.1 1 Feb 2014 00:25:04 -0000 1.50 +++ cwm.1 22 Jun 2014 14:27:26 -0000 @@ -98,6 +98,14 @@ Toggle maximization of current window. Toggle vertical maximization of current window. .It Ic CMS-= Toggle horizontal maximization of current window. +.It Ic CM-t +Move window to the top left corner of screen. +.It Ic CM-y +Move window to the top right corner of screen. +.It Ic CM-v +Move window to the bottom left corner of screen. +.It Ic CM-b +Move window to the bottom right corner of screen. .It Ic M-? Spawn .Dq exec program Index: kbfunc.c =================================================================== RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v retrieving revision 1.95 diff -u -p -r1.95 kbfunc.c --- kbfunc.c 30 Jan 2014 15:41:11 -0000 1.95 +++ kbfunc.c 22 Jun 2014 14:27:26 -0000 @@ -480,3 +480,47 @@ kbfunc_tile(struct client_ctx *cc, union break; } } + +void +kbfunc_client_move_edge(struct client_ctx *cc, union arg *arg) +{ + struct screen_ctx *sc = cc->sc; + struct geom xine; + int flags; + + /* + * pick screen that the middle of the window is on. + * that's probably more fair than if just the origin of + * a window is poking over a boundary + */ + xine = screen_find_xinerama(sc, + cc->geom.x + cc->geom.w / 2, + cc->geom.y + cc->geom.h / 2, CWM_GAP); + + flags = arg->i; + + switch (flags) { + case CWM_TOP_LEFT: + cc->geom.x = xine.x; + cc->geom.y = xine.y; + client_move(cc); + break; + case CWM_BOTTOM_LEFT: + cc->geom.x = xine.x; + cc->geom.y = xine.y + xine.h - cc->geom.h - cc->bwidth * 2; + client_move(cc); + break; + case CWM_TOP_RIGHT: + cc->geom.x = xine.x + xine.w - cc->geom.w - cc->bwidth * 2; + cc->geom.y = xine.y; + client_move(cc); + break; + case CWM_BOTTOM_RIGHT: + cc->geom.x = xine.x + xine.w - cc->geom.w - cc->bwidth * 2; + cc->geom.y = xine.y + xine.h - cc->geom.h - cc->bwidth * 2; + client_move(cc); + break; + default: + warnx("invalid flags passed to kbfunc_client_move_edge"); + } +}