~ruther/dwl

3128a182212b98e04b5de20d625069102fa9321d — Rutherther 11 months ago 9077c88 + 46d9474
Merge branch 'patch/accessnthmonitor' into patched
2 files changed, 44 insertions(+), 1 deletions(-)

M config.def.h
M dwl.c
M config.def.h => config.def.h +3 -1
@@ 108,7 108,9 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
	{ MODKEY,                    KEY,            view,            {.ui = 1 << TAG} }, \
	{ MODKEY|WLR_MODIFIER_CTRL,  KEY,            toggleview,      {.ui = 1 << TAG} }, \
	{ MODKEY|WLR_MODIFIER_SHIFT, SKEY,           tag,             {.ui = 1 << TAG} }, \
	{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }
	{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }, \
	{ WLR_MODIFIER_ALT,          KEY,            focusnthmon,     {.ui = 1 << TAG }, \
	{ WLR_MODIFIER_ALT|WLR_MODIFIER_SHIFT, SKEY, tagnthmon,       {.ui = 1 << TAG }

/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }

M dwl.c => dwl.c +41 -0
@@ 11,6 11,7 @@
#include <time.h>
#include <unistd.h>
#include <wayland-server-core.h>
#include <wayland-util.h>
#include <wlr/backend.h>
#include <wlr/backend/libinput.h>
#include <wlr/render/allocator.h>


@@ 297,8 298,10 @@ static void dwl_ipc_output_set_client_tags(struct wl_client *client, struct wl_r
static void dwl_ipc_output_set_layout(struct wl_client *client, struct wl_resource *resource, uint32_t index);
static void dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource, uint32_t tagmask, uint32_t toggle_tagset);
static void dwl_ipc_output_release(struct wl_client *client, struct wl_resource *resource);
static Monitor *numtomon(int num);
static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg);
static void focusnthmon(const Arg *arg);
static void focusstack(const Arg *arg);
static Client *focustop(Monitor *m);
static void fullscreennotify(struct wl_listener *listener, void *data);


@@ 348,6 351,7 @@ static void spawn(const Arg *arg);
static void startdrag(struct wl_listener *listener, void *data);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tagnthmon(const Arg *arg);
static void tile(Monitor *m);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);


@@ 1262,6 1266,22 @@ dirtomon(enum wlr_direction dir)
	return selmon;
}

Monitor *
numtomon(int num)
{
	Monitor *m = NULL;
	int i = 0;

	wl_list_for_each(m, &mons, link) {
		if (!m->wlr_output->enabled)
			i--;
		if (i == num)
			break;
		i++;
	}
	return m;
}

void
dwl_ipc_manager_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{


@@ 1534,6 1554,18 @@ focusmon(const Arg *arg)
}

void
focusnthmon(const Arg *arg)
{
	Monitor *m;
	if (arg->i > wl_list_length(&mons))
		return;
	if ((m = numtomon(arg->i)) == selmon)
		return;
	selmon = m;
	focusclient(focustop(selmon), 1);
}

void
focusstack(const Arg *arg)
{
	/* Focus the next or previous client (in tiling order) on selmon */


@@ 2752,6 2784,15 @@ tagmon(const Arg *arg)
}

void
tagnthmon(const Arg *arg)
{
	Client *sel = focustop(selmon);
	if (arg->i > wl_list_length(&mons))
		return;
	setmon(sel, numtomon(arg->i), 0);
}

void
tile(Monitor *m)
{
	unsigned int mw, my, ty;

Do not follow this link