Hi,
quite primitive features, but until cwmrc parsing grows to support passing
arguments with binds(i jk:P), these cover some cases for binary minded ppl
partitioning the available pixels for use:)
Comments?
I left out man page bits on purpose, but this works with ie.:
bind-key C4-h window-hhalve
bind-key C4-v window-vhalve
-Artturi
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index 300632cdc..1335bce88 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/calmwm.h
@@ -64,6 +64,8 @@
#define CWM_DOWN_RIGHT (CWM_DOWN | CWM_RIGHT)
#define CWM_DOWN_LEFT (CWM_DOWN | CWM_LEFT)
#define DIRECTIONMASK (CWM_UP | CWM_DOWN | CWM_LEFT | CWM_RIGHT)
+#define CWM_HORIZONTAL 0x0020
+#define CWM_VERTICAL 0x0040
#define CWM_CYCLE_FORWARD 0x0001
#define CWM_CYCLE_REVERSE 0x0002
@@ -400,6 +402,7 @@ void client_draw_border(struct
client_ctx *);
struct client_ctx *client_find(Window);
long client_get_wm_state(struct client_ctx *);
void client_getsizehints(struct client_ctx *);
+void client_halve(struct client_ctx *, int);
void client_hide(struct client_ctx *);
void client_htile(struct client_ctx *);
void client_lower(struct client_ctx *);
@@ -497,6 +500,8 @@ void
kbfunc_client_toggle_fullscreen(void *,
void kbfunc_client_toggle_maximize(void *, struct cargs *);
void kbfunc_client_toggle_hmaximize(void *, struct cargs *);
void kbfunc_client_toggle_vmaximize(void *, struct cargs *);
+void kbfunc_client_hhalve(void *, struct cargs *);
+void kbfunc_client_vhalve(void *, struct cargs *);
void kbfunc_client_htile(void *, struct cargs *);
void kbfunc_client_vtile(void *, struct cargs *);
void kbfunc_client_cycle(void *, struct cargs *);
diff --git a/app/cwm/client.c b/app/cwm/client.c
index 11eac06c4..be7d16cd6 100644
--- a/app/cwm/client.c
+++ b/app/cwm/client.c
@@ -966,6 +966,28 @@ client_snapcalc(int n0, int n1, int e0, int e1, int
snapdist)
return(0);
}
+void
+client_halve(struct client_ctx *cc, int direction)
+{
+
+ if (cc->flags & CLIENT_FREEZE)
+ return;
+
+ switch (direction) {
+ case CWM_HORIZONTAL:
+ cc->geom.w /= 2;
+ break;
+ case CWM_VERTICAL:
+ cc->geom.h /= 2;
+ break;
+ default:
+ return;
+ }
+
+ client_resize(cc, 0);
+ xu_ewmh_set_net_wm_state(cc);
+}
+
void
client_htile(struct client_ctx *cc)
{
diff --git a/app/cwm/conf.c b/app/cwm/conf.c
index 790daa2a0..235b7cc60 100644
--- a/app/cwm/conf.c
+++ b/app/cwm/conf.c
@@ -69,6 +69,8 @@ static const struct {
{ FUNC_CC(window-raise, client_raise, 0) },
{ FUNC_CC(window-hide, client_hide, 0) },
{ FUNC_CC(window-delete, client_delete, 0) },
+ { FUNC_CC(window-hhalve, client_hhalve, 0) },
+ { FUNC_CC(window-vhalve, client_vhalve, 0) },
{ FUNC_CC(window-htile, client_htile, 0) },
{ FUNC_CC(window-vtile, client_vtile, 0) },
{ FUNC_CC(window-stick, client_toggle_sticky, 0) },
diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c
index 7a205d0ff..d6f0d6e4b 100644
--- a/app/cwm/kbfunc.c
+++ b/app/cwm/kbfunc.c
@@ -395,6 +395,18 @@ kbfunc_client_vtile(void *ctx, struct cargs *cargs)
client_vtile(ctx);
}
+void
+kbfunc_client_hhalve(void *ctx, struct cargs *cargs)
+{
+ client_halve(ctx, CWM_HORIZONTAL);
+}
+
+void
+kbfunc_client_vhalve(void *ctx, struct cargs *cargs)
+{
+ client_halve(ctx, CWM_VERTICAL);
+}
+
void
kbfunc_client_cycle(void *ctx, struct cargs *cargs)
{