sites

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

dwm-toggletopbar-barpadding-6.4.diff (1643B)


      1 diff -up a/config.def.h b/config.def.h
      2 --- a/config.def.h	2022-10-28 22:20:44.531059708 +0200
      3 +++ b/config.def.h	2022-10-28 22:21:12.621059000 +0200
      4 @@ -67,6 +67,7 @@ static const Key keys[] = {
      5  	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
      6  	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
      7  	{ MODKEY,                       XK_b,      togglebar,      {0} },
      8 +	{ MODKEY,                       XK_t,      toggletopbar,   {0} },
      9  	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
     10  	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
     11  	{ MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
     12 diff -up a/b.c b/b.c
     13 --- a/b.c	2022-10-28 22:20:44.532059708 +0200
     14 +++ b/b.c	2022-10-28 22:23:27.019055613 +0200
     15 @@ -211,6 +211,7 @@ static void tag(const Arg *arg);
     16  static void tagmon(const Arg *arg);
     17  static void tile(Monitor *m);
     18  static void togglebar(const Arg *arg);
     19 +static void toggletopbar(const Arg *arg);
     20  static void togglefloating(const Arg *arg);
     21  static void toggletag(const Arg *arg);
     22  static void toggleview(const Arg *arg);
     23 @@ -1710,6 +1711,20 @@ togglebar(const Arg *arg)
     24  	arrange(selmon);
     25  }
     26  
     27 +void
     28 +toggletopbar(const Arg *arg)
     29 +{
     30 +    selmon->topbar = !selmon->topbar;
     31 +	updatebarpos(selmon);
     32 +
     33 +	if (selmon->topbar)
     34 +	    XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh);
     35 +	else
     36 +	    XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by - vp, selmon->ww - 2 * sp, bh);
     37 +
     38 +	arrange(selmon);
     39 +}
     40 +
     41  void
     42  togglefloating(const Arg *arg)
     43  {