mfwm

A tiling fork of dylanaraps sowm.
git clone git://depsterr.com/git/mfwm
Log | Files | Refs | README | LICENSE

commit 4aa7d1a4d6e92bc10cd0a5a3ca5a2c9d4812c027
parent e0d0415d06ee6747a7b4f25d583e6c1fb9f5ca65
Author: dylan <dylan.araps@gmail.com>
Date:   Tue, 21 Jan 2020 02:31:16 +0200

Merge pull request #48 from SeungheonOh/master

Patch: 2bswm-style fixed
Diffstat:
Mpatches/sowm-2bswm-style.patch | 60++++++++++++++++++++----------------------------------------
1 file changed, 20 insertions(+), 40 deletions(-)

diff --git a/patches/sowm-2bswm-style.patch b/patches/sowm-2bswm-style.patch @@ -1,11 +1,16 @@ diff --git a/config.def.h b/config.def.h -index cae2009..9ad7175 100644 +index cae2009..f787cbd 100644 --- a/config.def.h +++ b/config.def.h -@@ -26,6 +26,26 @@ static struct key keys[] = { +@@ -26,6 +26,20 @@ static struct key keys[] = { {MOD, XK_p, run, {.com = scrot}}, {MOD, XK_Return, run, {.com = term}}, ++ /* ++ * 2bswm-patch. ++ * .i => Increment/Decrement size ++ * .com => {(move/resize), (direction)} ++ */ + {MOD, XK_h, move, {.com=(char*[]){"move", "left"}, .i=10}}, + {MOD, XK_j, move, {.com=(char*[]){"move", "down"}, .i=10}}, + {MOD, XK_k, move, {.com=(char*[]){"move", "up"}, .i=10}}, @@ -15,82 +20,57 @@ index cae2009..9ad7175 100644 + {MOD|ShiftMask, XK_k, move, {.com=(char*[]){"resize", "up"}, .i=10}}, + {MOD|ShiftMask, XK_l, move, {.com=(char*[]){"resize", "right"}, .i=10}}, + -+ /* -+ {MOD, XK_h, move_left, {.com = {"move"},.i=10}}, -+ {MOD, XK_j, move_down, {.com = {"move"},.i=10}}, -+ {MOD, XK_k, move_up, {.com = {"move"},.i=10}}, -+ {MOD, XK_l, move_right, {.com = {"move"},.i=10}}, -+ {MOD|ShiftMask, XK_h, resize_left, {.com = {"resize"},.i=10}}, -+ {MOD|ShiftMask, XK_j, resize_down, {.com = {"resize"},.i=10}}, -+ {MOD|ShiftMask, XK_k, resize_up, {.com = {"resize"},.i=10}}, -+ {MOD|ShiftMask, XK_l, resize_right, {.com = {"resize"},.i=10}}, -+ */ -+ {0, XF86XK_AudioLowerVolume, run, {.com = voldown}}, {0, XF86XK_AudioRaiseVolume, run, {.com = volup}}, {0, XF86XK_AudioMute, run, {.com = volmute}}, diff --git a/sowm.c b/sowm.c -index 48222c6..00e2e80 100644 +index 90ae3bc..7c76571 100644 --- a/sowm.c +++ b/sowm.c -@@ -7,8 +7,9 @@ - #include <stdlib.h> +@@ -8,7 +8,7 @@ #include <signal.h> #include <unistd.h> -+#include <stdio.h> -typedef union { +typedef struct { const char** com; const int i; const Window w; -@@ -46,6 +47,9 @@ static void win_prev(); +@@ -46,6 +46,8 @@ static void win_prev(); static void win_next(); static void win_to_ws(const Arg arg); static void ws_go(const Arg arg); +static void apply(int x, int y, int w, int h); +static void move(const Arg arg); -+ static int xerror() { return 0;} static client *list = {0}, *ws_list[10] = {0}, *cur; -@@ -77,6 +81,31 @@ static void (*events[LASTEvent])(XEvent *e) = { - XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \ - &(unsigned int){0}, &(unsigned int){0}) +@@ -80,6 +82,28 @@ static void (*events[LASTEvent])(XEvent *e) = { + #define mod_clean(mask) (mask & ~(numlock|LockMask) & \ + (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) -+void apply(int x,int y,int w,int h) { ++void apply(int x, int y, int w, int h) { + win_size(cur->w, &wx, &wy, &ww, &wh); + XMoveResizeWindow(d, cur->w, -+ wx + x, -+ wy + y, -+ ww + w, -+ wh + h); -+ win_size(cur->w, &wx, &wy, &ww, &wh); ++ wx + x, wy + y, ++ ww + w, wh + h); +} + +void move(const Arg arg) { + if(arg.com[1]=="left") { -+ apply((arg.com[0]=="resize")?arg.i:-arg.i, 0, (arg.com[0]=="resize")?-arg.i:0, 0); ++ apply((arg.com[0]=="resize")?0:-arg.i, 0, (arg.com[0]=="resize")?-arg.i:0, 0); + } + else if(arg.com[1]=="right"){ -+ apply((arg.com[0]=="resize")?-arg.i:arg.i, 0, (arg.com[0]=="resize")?arg.i:0, 0); ++ apply((arg.com[0]=="resize")?0:arg.i, 0, (arg.com[0]=="resize")?arg.i:0, 0); + } + else if(arg.com[1]=="up"){ -+ apply(0, (arg.com[0]=="resize")?arg.i:-arg.i, 0, (arg.com[0]=="resize")?-arg.i:0); ++ apply(0, (arg.com[0]=="resize")?0:-arg.i, 0, (arg.com[0]=="resize")?-arg.i:0); + } + else if(arg.com[1]=="down"){ -+ apply(0, (arg.com[0]=="resize")?-arg.i:arg.i, 0, (arg.com[0]=="resize")?arg.i:0); ++ apply(0, (arg.com[0]=="resize")?0:arg.i, 0, (arg.com[0]=="resize")?arg.i:0); + } +} + void win_focus(client *c) { cur = c; XSetInputFocus(d, cur->w, RevertToParent, CurrentTime); -@@ -130,6 +159,7 @@ void button_press(XEvent *e) { - } - - void button_release() { -+ win_size(cur->w, &wx, &wy, &ww, &wh); - mouse.subwindow = 0; - } -