summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStivvo <stivvo01@gmail.com>2020-09-05 11:22:24 +0200
committerGuido Cella <guido@guidocella.xyz>2020-12-19 18:06:11 +0100
commitf125e1b9a4e05a5282765b0b699f8a097ea65783 (patch)
treea7efb4fa75377e2b0c1dbf345090417e06e88cec
parentd41cc60ec102d06b6c3e41c587fbb05b3a45e05e (diff)
Toggle fullscreen on all clients
mod+e allows to toggle fullscreen any client, even those who don't support it themselves
-rw-r--r--config.def.h1
-rw-r--r--dwl.c21
2 files changed, 19 insertions, 3 deletions
diff --git a/config.def.h b/config.def.h
index 53021cf..d821a96 100644
--- a/config.def.h
+++ b/config.def.h
@@ -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} },
diff --git a/dwl.c b/dwl.c
index bd87590..bc2a3e8 100644
--- a/dwl.c
+++ b/dwl.c
@@ -267,6 +267,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);
@@ -278,6 +279,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 unmaplayersurface(LayerSurface *layersurface);
@@ -1069,10 +1071,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)
@@ -1093,6 +1101,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)
{