~ruther/dwl

def35721172f205c6934fa5a683f63f68342ddec — Devin J. Pohly 5 years ago fdbe9ee
add setlayout function
2 files changed, 13 insertions(+), 0 deletions(-)

M config.h
M dwl.c
M config.h => config.h +2 -0
@@ 36,6 36,8 @@ static const Key keys[] = {
	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn,     {.v = termcmd } },
	{ MODKEY,                    XKB_KEY_Escape, quit,      {0} },
	{ MODKEY,                    XKB_KEY_F1,     focusnext, {0} },
	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_L,      setlayout, {.v = &layouts[0]} },
	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_F,      setlayout, {.v = &layouts[1]} },
};

static const Button buttons[] = {

M dwl.c => dwl.c +11 -0
@@ 143,6 143,7 @@ static void resize(Client *c, int x, int y, int w, int h);
static void resizemouse(const Arg *arg);
static void run(char *startup_cmd);
static void setcursor(struct wl_listener *listener, void *data);
static void setlayout(const Arg *arg);
static void setup(void);
static void spawn(const Arg *arg);
static void tile(Monitor *m);


@@ 886,6 887,16 @@ setcursor(struct wl_listener *listener, void *data)
}

void
setlayout(const Arg *arg)
{
	if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
		selmon->sellt ^= 1;
	if (arg && arg->v)
		selmon->lt[selmon->sellt] = (Layout *)arg->v;
	/* XXX change layout symbol? */
}

void
setup(void)
{
	/* The backend is a wlroots feature which abstracts the underlying input and

Do not follow this link