From a0abfa50545a44a9a83896d28999e27f669cfe04 Mon Sep 17 00:00:00 2001 From: Unixsys <64293761+Unixsys@users.noreply.github.com> Date: Fri, 24 Apr 2020 21:13:18 -0500 Subject: [PATCH 1/3] Add window splitting functionality in sowm.c --- sowm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sowm.c b/sowm.c index 9e2c58d..6ea6642 100644 --- a/sowm.c +++ b/sowm.c @@ -31,6 +31,18 @@ static void (*events[LASTEvent])(XEvent *e) = { #include "config.h" +void win_half(const Arg arg) { + char m = arg.com[0][0]; + + win_size(cur->w, &wx, &wy, &ww, &wh); + + XMoveResizeWindow(d, cur->w, \ + (m == 'w' ? wx : m == 'e' ? (wx + ww / 2) : wx), + (m == 'n' ? wy : m == 's' ? (wy + wh / 2) : wy), + (m == 'w' ? (ww / 2) : m == 'e' ? (ww / 2) : ww), + (m == 'n' ? (wh / 2) : m == 's' ? (wh / 2) : wh)); +} + void win_focus(client *c) { cur = c; XSetInputFocus(d, cur->w, RevertToParent, CurrentTime); From 5ee73f8db7e2d7a65c30caa0c63efaabc711b7f8 Mon Sep 17 00:00:00 2001 From: Unixsys <64293761+Unixsys@users.noreply.github.com> Date: Fri, 24 Apr 2020 21:16:03 -0500 Subject: [PATCH 2/3] Add keybinds for window splitting --- config.def.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config.def.h b/config.def.h index cae2009..86f0248 100644 --- a/config.def.h +++ b/config.def.h @@ -17,6 +17,12 @@ static struct key keys[] = { {MOD, XK_q, win_kill, {0}}, {MOD, XK_c, win_center, {0}}, {MOD, XK_f, win_fs, {0}}, + + {MOD|Mod1Mask, XK_k, win_half, {.com = (const char*[]){"n"}}}, + {MOD|Mod1Mask, XK_j, win_half, {.com = (const char*[]){"s"}}}, + {MOD|Mod1Mask, XK_l, win_half, {.com = (const char*[]){"e"}}}, + {MOD|Mod1Mask, XK_h, win_half, {.com = (const char*[]){"w"}}}, + {Mod1Mask, XK_Tab, win_next, {0}}, {Mod1Mask|ShiftMask, XK_Tab, win_prev, {0}}, From a65e215e833d16ee98a063cfd3bf7505c47ce883 Mon Sep 17 00:00:00 2001 From: Unixsys <64293761+Unixsys@users.noreply.github.com> Date: Fri, 24 Apr 2020 21:16:52 -0500 Subject: [PATCH 3/3] add function declaration --- sowm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sowm.h b/sowm.h index 455ed93..0d49e36 100644 --- a/sowm.h +++ b/sowm.h @@ -51,6 +51,7 @@ void win_focus(client *c); void win_kill(const Arg arg); void win_prev(const Arg arg); void win_next(const Arg arg); +void win_half(const Arg arg); void win_to_ws(const Arg arg); void ws_go(const Arg arg);