Download raw body.
cwm(1): add window-snap-center function
This adds 'window-snap-center' to the 'window-snap-*' family of
functions. With this function users can center the window. Thoughts?
Index: calmwm.h
===================================================================
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
diff -u -p -r1.379 calmwm.h
--- calmwm.h 20 Jul 2023 14:39:34 -0000 1.379
+++ calmwm.h 12 Aug 2025 20:55:19 -0000
@@ -55,6 +55,7 @@
#define CWM_LEFT 0x0004
#define CWM_RIGHT 0x0008
#define CWM_BIGAMOUNT 0x0010
+#define CWM_CENTER 0x0020
#define CWM_UP_BIG (CWM_UP | CWM_BIGAMOUNT)
#define CWM_DOWN_BIG (CWM_DOWN | CWM_BIGAMOUNT)
#define CWM_LEFT_BIG (CWM_LEFT | CWM_BIGAMOUNT)
Index: conf.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/conf.c,v
diff -u -p -r1.256 conf.c
--- conf.c 20 Jul 2023 14:39:34 -0000 1.256
+++ conf.c 12 Aug 2025 20:55:19 -0000
@@ -102,6 +102,7 @@ static const struct {
{ FUNC_CC(window-movetogroup-7, client_movetogroup, 7) },
{ FUNC_CC(window-movetogroup-8, client_movetogroup, 8) },
{ FUNC_CC(window-movetogroup-9, client_movetogroup, 9) },
+ { FUNC_CC(window-snap-center, client_snap, (CWM_CENTER)) },
{ FUNC_CC(window-snap-up, client_snap, (CWM_UP)) },
{ FUNC_CC(window-snap-down, client_snap, (CWM_DOWN)) },
{ FUNC_CC(window-snap-right, client_snap, (CWM_RIGHT)) },
Index: cwmrc.5
===================================================================
RCS file: /cvs/xenocara/app/cwm/cwmrc.5,v
diff -u -p -r1.78 cwmrc.5
--- cwmrc.5 20 Jul 2023 14:39:34 -0000 1.78
+++ cwmrc.5 12 Aug 2025 20:55:20 -0000
@@ -401,6 +401,8 @@ pixels right.
Resize window 10 times
.Ar moveamount
pixels left.
+.It window-snap-center
+Snap window to center.
.It window-snap-up
Snap window to top edge.
.It window-snap-down
Index: kbfunc.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
diff -u -p -r1.175 kbfunc.c
--- kbfunc.c 10 Apr 2024 19:38:22 -0000 1.175
+++ kbfunc.c 12 Aug 2025 20:55:20 -0000
@@ -320,6 +320,13 @@ kbfunc_client_snap(void *ctx, struct car
(cc->bwidth * 2);
flags &= ~CWM_DOWN;
}
+ if (flags & CWM_CENTER) {
+ cc->geom.x = area.x +
+ (area.w - cc->geom.w - cc->bwidth) / 2;
+ cc->geom.y = area.y +
+ (area.h - cc->geom.h - cc->bwidth) / 2;
+ flags &= ~CWM_CENTER;
+ }
}
client_move(cc);
client_ptr_inbound(cc, 1);
cwm(1): add window-snap-center function