sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-actualfullscreen-6.8.diff (3983B)


      1 From 12e0fc50ff6b02ac926b77b7d16601ef8051309b Mon Sep 17 00:00:00 2001
      2 From: Sourav Nayak <nonameblank007@gmail.com>
      3 Date: Thu, 2 Jul 2026 23:01:18 +0530
      4 Subject: [PATCH] Fullscreen current window and overlay application
      5 
      6 This actually fullscreens a window, instead of just hiding the statusbar
      7 and applying the monocle layout with [Alt]+[Shift]+[f].
      8 
      9 Addition to this patch now supports overlay apllication through config rules,
     10 that require fullscreen on run. e.g., KDE Presentation Mode, Quickshell custom overlays... etc.
     11 
     12 Note: If using a compositor like picom, do disable blur for those applications
     13 ---
     14  config.def.h |  7 ++++---
     15  dwm.1        |  3 +++
     16  dwm.c        | 14 ++++++++++++++
     17  3 files changed, 21 insertions(+), 3 deletions(-)
     18 
     19 diff --git a/config.def.h b/config.def.h
     20 index 81c3fc0..03edae9 100644
     21 --- a/config.def.h
     22 +++ b/config.def.h
     23 @@ -26,9 +26,9 @@ static const Rule rules[] = {
     24  	 *	WM_CLASS(STRING) = instance, class
     25  	 *	WM_NAME(STRING) = title
     26  	 */
     27 -	/* class      instance    title       tags mask     isfloating   monitor */
     28 -	{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
     29 -	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
     30 +	/* class      instance    title       tags mask     isfloating   isfullscreen   monitor */
     31 +	{ "Gimp",     NULL,       NULL,       0,            1,           0,             -1 },
     32 +	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           0,             -1 },
     33  };
     34  
     35  /* layout(s) */
     36 @@ -80,6 +80,7 @@ static const Key keys[] = {
     37  	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
     38  	{ MODKEY,                       XK_space,  setlayout,      {0} },
     39  	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
     40 +	{ MODKEY|ShiftMask,             XK_f,      togglefullscr,  {0} },
     41  	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
     42  	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
     43  	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
     44 diff --git a/dwm.1 b/dwm.1
     45 index ddc8321..3d310ac 100644
     46 --- a/dwm.1
     47 +++ b/dwm.1
     48 @@ -116,6 +116,9 @@ Zooms/cycles focused window to/from master area (tiled layouts only).
     49  .B Mod1\-Shift\-c
     50  Close focused window.
     51  .TP
     52 +.B Mod1\-Shift\-f
     53 +Toggle fullscreen for focused window.
     54 +.TP
     55  .B Mod1\-Shift\-space
     56  Toggle focused window between tiled and floating state.
     57  .TP
     58 diff --git a/dwm.c b/dwm.c
     59 index 53b393e..228c9b3 100644
     60 --- a/dwm.c
     61 +++ b/dwm.c
     62 @@ -137,6 +137,7 @@ typedef struct {
     63  	const char *title;
     64  	unsigned int tags;
     65  	int isfloating;
     66 +	int isfullscreen;
     67  	int monitor;
     68  } Rule;
     69  
     70 @@ -210,6 +211,7 @@ static void tagmon(const Arg *arg);
     71  static void tile(Monitor *m);
     72  static void togglebar(const Arg *arg);
     73  static void togglefloating(const Arg *arg);
     74 +static void togglefullscr(const Arg *arg);
     75  static void toggletag(const Arg *arg);
     76  static void toggleview(const Arg *arg);
     77  static void unfocus(Client *c, int setfocus);
     78 @@ -284,6 +286,7 @@ applyrules(Client *c)
     79  	XClassHint ch = { NULL, NULL };
     80  
     81  	/* rule matching */
     82 +	int isfullscreen = 0;
     83  	c->isfloating = 0;
     84  	c->tags = 0;
     85  	XGetClassHint(dpy, c->win, &ch);
     86 @@ -296,6 +299,8 @@ applyrules(Client *c)
     87  		&& (!r->class || strstr(class, r->class))
     88  		&& (!r->instance || strstr(instance, r->instance)))
     89  		{
     90 +			isfullscreen = r->isfullscreen;
     91 +			
     92  			c->isfloating = r->isfloating;
     93  			c->tags |= r->tags;
     94  			for (m = mons; m && m->num != r->monitor; m = m->next);
     95 @@ -307,6 +312,8 @@ applyrules(Client *c)
     96  		XFree(ch.res_class);
     97  	if (ch.res_name)
     98  		XFree(ch.res_name);
     99 +	if (isfullscreen)
    100 +		setfullscreen(c, 1);
    101  	c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
    102  }
    103  
    104 @@ -1735,6 +1742,13 @@ togglefloating(const Arg *arg)
    105  	arrange(selmon);
    106  }
    107  
    108 +void
    109 +togglefullscr(const Arg *arg)
    110 +{
    111 +  if(selmon->sel)
    112 +    setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
    113 +}
    114 +
    115  void
    116  toggletag(const Arg *arg)
    117  {
    118 -- 
    119 2.54.0
    120