~ruther/dwl

2cb526bbd923383ae903130478033f3403bc5351 — Devin J. Pohly 5 years ago eafd317
add chvt function

It truly isn't just a window manager anymore :-|
2 files changed, 13 insertions(+), 0 deletions(-)

M config.def.h
M dwl.c
M config.def.h => config.def.h +3 -0
@@ 70,6 70,9 @@ static const Key keys[] = {
	TAGKEYS(          XKB_KEY_8, XKB_KEY_asterisk,                   7),
	TAGKEYS(          XKB_KEY_9, XKB_KEY_parenleft,                  8),
	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q,          quit,           {0} },
#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
	CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
	CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
};

static const Button buttons[] = {

M dwl.c => dwl.c +10 -0
@@ 126,6 126,7 @@ struct render_data {
static void arrange(Monitor *m);
static void axisnotify(struct wl_listener *listener, void *data);
static void buttonpress(struct wl_listener *listener, void *data);
static void chvt(const Arg *arg);
static void createkeyboard(struct wlr_input_device *device);
static void createmon(struct wl_listener *listener, void *data);
static void createnotify(struct wl_listener *listener, void *data);


@@ 230,6 231,15 @@ axisnotify(struct wl_listener *listener, void *data)
}

void
chvt(const Arg *arg)
{
	struct wlr_session *s = wlr_backend_get_session(backend);
	if (!s)
		return;
	wlr_session_change_vt(s, arg->ui);
}

void
buttonpress(struct wl_listener *listener, void *data)
{
	/* This event is forwarded by the cursor when a pointer emits a button

Do not follow this link