aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--calmwm.h3
-rw-r--r--conf.c20
-rw-r--r--cwmrc.520
-rw-r--r--kbfunc.c38
4 files changed, 76 insertions, 5 deletions
diff --git a/calmwm.h b/calmwm.h
index 21fa3ae..5ee66f2 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.h,v 1.343 2017/12/07 16:03:10 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.344 2017/12/07 16:25:33 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -465,6 +465,7 @@ void screen_assert_clients_within(struct screen_ctx *);
void kbfunc_cwm_status(void *, struct cargs *);
void kbfunc_ptrmove(void *, struct cargs *);
+void kbfunc_client_snap(void *, struct cargs *);
void kbfunc_client_move(void *, struct cargs *);
void kbfunc_client_resize(void *, struct cargs *);
void kbfunc_client_delete(void *, struct cargs *);
diff --git a/conf.c b/conf.c
index 1405f20..d0b4503 100644
--- a/conf.c
+++ b/conf.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: conf.c,v 1.234 2017/12/07 15:47:14 okan Exp $
+ * $OpenBSD: conf.c,v 1.235 2017/12/07 16:25:33 okan Exp $
*/
#include <sys/types.h>
@@ -92,6 +92,24 @@ static const struct {
{ "window-movetogroup-8", kbfunc_client_movetogroup, CWM_CONTEXT_CC, 8 },
{ "window-movetogroup-9", kbfunc_client_movetogroup, CWM_CONTEXT_CC, 9 },
+ { "window-snap-up", kbfunc_client_snap, CWM_CONTEXT_CC,
+ (CWM_UP) },
+ { "window-snap-down", kbfunc_client_snap, CWM_CONTEXT_CC,
+ (CWM_DOWN) },
+ { "window-snap-left", kbfunc_client_snap, CWM_CONTEXT_CC,
+ (CWM_LEFT) },
+ { "window-snap-right", kbfunc_client_snap, CWM_CONTEXT_CC,
+ (CWM_RIGHT) },
+
+ { "window-snap-up-right", kbfunc_client_snap, CWM_CONTEXT_CC,
+ (CWM_UP|CWM_RIGHT) },
+ { "window-snap-up-left", kbfunc_client_snap, CWM_CONTEXT_CC,
+ (CWM_UP|CWM_LEFT) },
+ { "window-snap-down-right", kbfunc_client_snap, CWM_CONTEXT_CC,
+ (CWM_DOWN|CWM_RIGHT) },
+ { "window-snap-down-left", kbfunc_client_snap, CWM_CONTEXT_CC,
+ (CWM_DOWN|CWM_LEFT) },
+
{ "window-move", kbfunc_client_move, CWM_CONTEXT_CC, 0 },
{ "window-move-up", kbfunc_client_move, CWM_CONTEXT_CC,
(CWM_UP) },
diff --git a/cwmrc.5 b/cwmrc.5
index c044702..4e6c890 100644
--- a/cwmrc.5
+++ b/cwmrc.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwmrc.5,v 1.68 2017/07/06 17:09:17 okan Exp $
+.\" $OpenBSD: cwmrc.5,v 1.69 2017/12/07 16:25:33 okan Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 6 2017 $
+.Dd $Mdocdate: December 7 2017 $
.Dt CWMRC 5
.Os
.Sh NAME
@@ -398,6 +398,22 @@ pixels right.
Resize window 10 times
.Ar moveamount
pixels left.
+.It window-snap-up
+Snap window to top edge.
+.It window-snap-down
+Snap window to bottom edge.
+.It window-snap-right
+Snap window to right edge.
+.It window-snap-left
+Snap window to left edge.
+.It window-snap-up-right
+Snap window to top-right corner.
+.It window-snap-up-left
+Snap window to top-left corner.
+.It window-snap-down-right
+Snap window to bottom-right corner.
+.It window-snap-down-left
+Snap window to bottom-left corner.
.It pointer-move-up
Move pointer
.Ar moveamount
diff --git a/kbfunc.c b/kbfunc.c
index 3959046..54d2216 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: kbfunc.c,v 1.152 2017/12/07 16:03:10 okan Exp $
+ * $OpenBSD: kbfunc.c,v 1.153 2017/12/07 16:25:33 okan Exp $
*/
#include <sys/types.h>
@@ -287,6 +287,42 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs)
}
void
+kbfunc_client_snap(void *ctx, struct cargs *cargs)
+{
+ struct client_ctx *cc = ctx;
+ struct screen_ctx *sc = cc->sc;
+ struct geom area;
+ int flags;
+
+ area = screen_area(sc,
+ cc->geom.x + cc->geom.w / 2,
+ cc->geom.y + cc->geom.h / 2, CWM_GAP);
+
+ flags = cargs->flag;
+ while (flags) {
+ if (flags & CWM_UP) {
+ cc->geom.y = area.y;
+ flags &= ~CWM_UP;
+ }
+ if (flags & CWM_LEFT) {
+ cc->geom.x = area.x;
+ flags &= ~CWM_LEFT;
+ }
+ if (flags & CWM_RIGHT) {
+ cc->geom.x = area.x + area.w - cc->geom.w -
+ (cc->bwidth * 2);
+ flags &= ~CWM_RIGHT;
+ }
+ if (flags & CWM_DOWN) {
+ cc->geom.y = area.y + area.h - cc->geom.h -
+ (cc->bwidth * 2);
+ flags &= ~CWM_DOWN;
+ }
+ }
+ client_move(cc);
+}
+
+void
kbfunc_client_delete(void *ctx, struct cargs *cargs)
{
client_send_delete(ctx);