Toggle fullscreen on all clients

mod+e allows to toggle fullscreen any client, even those who don't
support it themselves
This commit is contained in:
Stivvo 2020-09-05 11:22:24 +02:00
parent d9cf3e064c
commit 621d4c9173
2 changed files with 19 additions and 3 deletions

View file

@ -75,6 +75,7 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = -1} },

21
dwl.c
View file

@ -232,6 +232,7 @@ static void setcursor(struct wl_listener *listener, void *data);
static void setpsel(struct wl_listener *listener, void *data);
static void setsel(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating);
static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m, unsigned int newtags);
@ -242,6 +243,7 @@ static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unmapnotify(struct wl_listener *listener, void *data);
@ -696,10 +698,16 @@ destroyxdeco(struct wl_listener *listener, void *data)
}
void
fullscreenotify(struct wl_listener *listener, void *data)
togglefullscreen(const Arg *arg)
{
Client *c = wl_container_of(listener, c, fullscreen);
c->isfullscreen = !c->isfullscreen;
Client *sel = selclient();
setfullscreen(sel, !sel->isfullscreen);
}
void
setfullscreen(Client *c, int fullscreen)
{
c->isfullscreen = fullscreen;
#ifdef XWAYLAND
if (c->type == X11Managed)
@ -720,6 +728,13 @@ fullscreenotify(struct wl_listener *listener, void *data)
}
}
void
fullscreenotify(struct wl_listener *listener, void *data)
{
Client *c = wl_container_of(listener, c, fullscreen);
setfullscreen(c, !c->isfullscreen);
}
Monitor *
dirtomon(int dir)
{