dwm-fullscreen-6.2.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-fullscreen-6.2.diff (1830B)
       ---
            1 From 54719285bd1a984e2efce6e8a8eab184fec11abf Mon Sep 17 00:00:00 2001
            2 From: Sermak <sermak@jarvis.com>
            3 Date: Mon, 8 Jul 2019 01:06:44 +0200
            4 Subject: [PATCH] Simulate toggleable fullscreen mode
            5 
            6 ---
            7  config.def.h |  1 +
            8  dwm.c        | 14 ++++++++++++++
            9  2 files changed, 15 insertions(+)
           10 
           11 diff --git a/config.def.h b/config.def.h
           12 index 1c0b587..f774cc5 100644
           13 --- a/config.def.h
           14 +++ b/config.def.h
           15 @@ -76,6 +76,7 @@ static Key keys[] = {
           16          { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
           17          { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
           18          { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
           19 +        { MODKEY|ShiftMask,             XK_f,      fullscreen,     {0} },
           20          { MODKEY,                       XK_space,  setlayout,      {0} },
           21          { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
           22          { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
           23 diff --git a/dwm.c b/dwm.c
           24 index 4465af1..04b1e06 100644
           25 --- a/dwm.c
           26 +++ b/dwm.c
           27 @@ -199,6 +199,7 @@ static void sendmon(Client *c, Monitor *m);
           28  static void setclientstate(Client *c, long state);
           29  static void setfocus(Client *c);
           30  static void setfullscreen(Client *c, int fullscreen);
           31 +static void fullscreen(const Arg *arg);
           32  static void setlayout(const Arg *arg);
           33  static void setmfact(const Arg *arg);
           34  static void setup(void);
           35 @@ -1497,6 +1498,19 @@ setfullscreen(Client *c, int fullscreen)
           36          }
           37  }
           38  
           39 +Layout *last_layout;
           40 +void
           41 +fullscreen(const Arg *arg)
           42 +{
           43 +        if (selmon->showbar) {
           44 +                for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
           45 +                setlayout(&((Arg) { .v = &layouts[2] }));
           46 +        } else {
           47 +                setlayout(&((Arg) { .v = last_layout }));
           48 +        }
           49 +        togglebar(arg);
           50 +}
           51 +
           52  void
           53  setlayout(const Arg *arg)
           54  {
           55 -- 
           56 2.22.0