Add killclient

This commit is contained in:
Guido Cella 2020-07-23 20:30:25 +02:00
parent 4a4a261111
commit ea73221b45
2 changed files with 15 additions and 0 deletions

View file

@ -60,6 +60,7 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} }, { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} }, { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
{ MODKEY, XKB_KEY_Tab, view, {0} }, { MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_c, killclient, {0} },
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },

14
dwl.c
View file

@ -171,6 +171,7 @@ static void inputdevice(struct wl_listener *listener, void *data);
static int keybinding(uint32_t mods, xkb_keysym_t sym); static int keybinding(uint32_t mods, xkb_keysym_t sym);
static void keypress(struct wl_listener *listener, void *data); static void keypress(struct wl_listener *listener, void *data);
static void keypressmod(struct wl_listener *listener, void *data); static void keypressmod(struct wl_listener *listener, void *data);
static void killclient(const Arg *arg);
static Client *lastfocused(void); static Client *lastfocused(void);
static void maprequest(struct wl_listener *listener, void *data); static void maprequest(struct wl_listener *listener, void *data);
static void motionabsolute(struct wl_listener *listener, void *data); static void motionabsolute(struct wl_listener *listener, void *data);
@ -812,6 +813,19 @@ keypressmod(struct wl_listener *listener, void *data)
&kb->device->keyboard->modifiers); &kb->device->keyboard->modifiers);
} }
void
killclient(const Arg *arg)
{
Client *sel = selclient();
if (!sel)
return;
if (sel->isx11)
wlr_xwayland_surface_close(sel->xwayland_surface);
else
wlr_xdg_toplevel_send_close(sel->xdg_surface);
}
Client * Client *
lastfocused(void) lastfocused(void)
{ {