From 50952da422e49b07877e642e2be37abb6ced4abc Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Sun, 21 Feb 2021 13:02:16 +0100 Subject: [PATCH 1/2] Toggle gap func --- src/config.h | 1 + src/dwm.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/config.h b/src/config.h index 9f125e5..f36d928 100644 --- a/src/config.h +++ b/src/config.h @@ -115,6 +115,7 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_x, spawn, {.v = betterlockscreencmd}}, { MODKEY, XK_Print, spawn, {.v = spectaclecmd}}, { MODKEY, XK_u, spawn, {.v = cmuspausecmd}}, + { MODKEY, XK_g, setgaps, {.v = cmuspausecmd}}, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) diff --git a/src/dwm.c b/src/dwm.c index 9f19db8..3994323 100644 --- a/src/dwm.c +++ b/src/dwm.c @@ -227,6 +227,7 @@ static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); static void setgaps(const Arg *arg); +static void togglegaps(const Arg *arg); static void setlayout(const Arg *arg); static void setlayoutsafe(const Arg *arg); static void setmfact(const Arg *arg); @@ -1687,6 +1688,12 @@ setgaps(const Arg *arg) arrange(selmon); } +void +togglegaps(const Arg *arg) +{ + +} + void setlayout(const Arg *arg) { From ff9e3c1b7763ab16a30cc3ee50d49bb98489b5c4 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Sun, 21 Feb 2021 21:24:03 +0100 Subject: [PATCH 2/2] Added togglegaps --- src/config.h | 8 ++++---- src/dwm.c | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/config.h b/src/config.h index f36d928..145a638 100644 --- a/src/config.h +++ b/src/config.h @@ -112,10 +112,10 @@ static Key keys[] = { { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_x, spawn, {.v = betterlockscreencmd}}, - { MODKEY, XK_Print, spawn, {.v = spectaclecmd}}, - { MODKEY, XK_u, spawn, {.v = cmuspausecmd}}, - { MODKEY, XK_g, setgaps, {.v = cmuspausecmd}}, + { MODKEY|ShiftMask, XK_x, spawn, {.v = betterlockscreencmd} }, + { MODKEY, XK_Print, spawn, {.v = spectaclecmd} }, + { MODKEY, XK_u, spawn, {.v = cmuspausecmd} }, + { MODKEY, XK_g, togglegaps, {0} }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) diff --git a/src/dwm.c b/src/dwm.c index 3994323..e59c605 100644 --- a/src/dwm.c +++ b/src/dwm.c @@ -1691,7 +1691,12 @@ setgaps(const Arg *arg) void togglegaps(const Arg *arg) { - + if(selmon->gappx == 0) { + selmon->gappx = gappx; + } else { + selmon->gappx = 0; + } + arrange(selmon); } void