From 12e0fc50ff6b02ac926b77b7d16601ef8051309b Mon Sep 17 00:00:00 2001 From: Sourav Nayak Date: Thu, 2 Jul 2026 23:01:18 +0530 Subject: [PATCH] Fullscreen current window and overlay application This actually fullscreens a window, instead of just hiding the statusbar and applying the monocle layout with [Alt]+[Shift]+[f]. Addition to this patch now supports overlay apllication through config rules, that require fullscreen on run. e.g., KDE Presentation Mode, Quickshell custom overlays... etc. Note: If using a compositor like picom, do disable blur for those applications --- config.def.h | 7 ++++--- dwm.1 | 3 +++ dwm.c | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/config.def.h b/config.def.h index 81c3fc0..03edae9 100644 --- a/config.def.h +++ b/config.def.h @@ -26,9 +26,9 @@ static const Rule rules[] = { * WM_CLASS(STRING) = instance, class * WM_NAME(STRING) = title */ - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, 1, -1 }, - { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, + /* class instance title tags mask isfloating isfullscreen monitor */ + { "Gimp", NULL, NULL, 0, 1, 0, -1 }, + { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 }, }; /* layout(s) */ @@ -80,6 +80,7 @@ static const Key keys[] = { { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, diff --git a/dwm.1 b/dwm.1 index ddc8321..3d310ac 100644 --- a/dwm.1 +++ b/dwm.1 @@ -116,6 +116,9 @@ Zooms/cycles focused window to/from master area (tiled layouts only). .B Mod1\-Shift\-c Close focused window. .TP +.B Mod1\-Shift\-f +Toggle fullscreen for focused window. +.TP .B Mod1\-Shift\-space Toggle focused window between tiled and floating state. .TP diff --git a/dwm.c b/dwm.c index 53b393e..228c9b3 100644 --- a/dwm.c +++ b/dwm.c @@ -137,6 +137,7 @@ typedef struct { const char *title; unsigned int tags; int isfloating; + int isfullscreen; int monitor; } Rule; @@ -210,6 +211,7 @@ static void tagmon(const Arg *arg); static void tile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); +static void togglefullscr(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); static void unfocus(Client *c, int setfocus); @@ -284,6 +286,7 @@ applyrules(Client *c) XClassHint ch = { NULL, NULL }; /* rule matching */ + int isfullscreen = 0; c->isfloating = 0; c->tags = 0; XGetClassHint(dpy, c->win, &ch); @@ -296,6 +299,8 @@ applyrules(Client *c) && (!r->class || strstr(class, r->class)) && (!r->instance || strstr(instance, r->instance))) { + isfullscreen = r->isfullscreen; + c->isfloating = r->isfloating; c->tags |= r->tags; for (m = mons; m && m->num != r->monitor; m = m->next); @@ -307,6 +312,8 @@ applyrules(Client *c) XFree(ch.res_class); if (ch.res_name) XFree(ch.res_name); + if (isfullscreen) + setfullscreen(c, 1); c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; } @@ -1735,6 +1742,13 @@ togglefloating(const Arg *arg) arrange(selmon); } +void +togglefullscr(const Arg *arg) +{ + if(selmon->sel) + setfullscreen(selmon->sel, !selmon->sel->isfullscreen); +} + void toggletag(const Arg *arg) { -- 2.54.0