dwm-barpadding-6.6.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-barpadding-6.6.diff (4677B)
       ---
            1 diff '--color=auto' -up ../dwm-6.6/config.def.h ./config.def.h
            2 --- ../dwm-6.6/config.def.h        2025-08-09 15:00:55.740267680 +0200
            3 +++ ./config.def.h        2025-11-18 16:16:23.935996023 +0100
            4 @@ -5,6 +5,8 @@ static const unsigned int borderpx  = 1;
            5  static const unsigned int snap      = 32;       /* snap pixel */
            6  static const int showbar            = 1;        /* 0 means no bar */
            7  static const int topbar             = 1;        /* 0 means bottom bar */
            8 +static const int vertpad            = 10;       /* vertical padding of bar */
            9 +static const int sidepad            = 10;       /* horizontal padding of bar */
           10  static const char *fonts[]          = { "monospace:size=10" };
           11  static const char dmenufont[]       = "monospace:size=10";
           12  static const char col_gray1[]       = "#222222";
           13 Nur in .: dwm-barpadding-6.6.diff.
           14 diff '--color=auto' -up ../dwm-6.6/dwm.c ./dwm.c
           15 --- ../dwm-6.6/dwm.c        2025-08-09 15:00:55.740267680 +0200
           16 +++ ./dwm.c        2025-11-18 16:16:56.505092231 +0100
           17 @@ -240,6 +240,8 @@ static int screen;
           18  static int sw, sh;           /* X display screen geometry width, height */
           19  static int bh;               /* bar height */
           20  static int lrpad;            /* sum of left and right padding for text */
           21 +static int vp;               /* vertical padding for bar */
           22 +static int sp;               /* side padding for bar */
           23  static int (*xerrorxlib)(Display *, XErrorEvent *);
           24  static unsigned int numlockmask = 0;
           25  static void (*handler[LASTEvent]) (XEvent *) = {
           26 @@ -569,7 +571,7 @@ configurenotify(XEvent *e)
           27                                  for (c = m->clients; c; c = c->next)
           28                                          if (c->isfullscreen)
           29                                                  resizeclient(c, m->mx, m->my, m->mw, m->mh);
           30 -                                XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
           31 +                                XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww -  2 * sp, bh);
           32                          }
           33                          focus(NULL);
           34                          arrange(NULL);
           35 @@ -710,7 +712,7 @@ drawbar(Monitor *m)
           36          if (m == selmon) { /* status is only drawn on selected monitor */
           37                  drw_setscheme(drw, scheme[SchemeNorm]);
           38                  tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
           39 -                drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
           40 +                drw_text(drw, m->ww - sw - 2 * sp, 0, sw, bh, 0, stext, 0);
           41          }
           42 
           43          for (c = m->clients; c; c = c->next) {
           44 @@ -736,12 +738,12 @@ drawbar(Monitor *m)
           45          if ((w = m->ww - tw - x) > bh) {
           46                  if (m->sel) {
           47                          drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
           48 -                        drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
           49 +                        drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, m->sel->name, 0);
           50                          if (m->sel->isfloating)
           51                                  drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
           52                  } else {
           53                          drw_setscheme(drw, scheme[SchemeNorm]);
           54 -                        drw_rect(drw, x, 0, w, bh, 1, 1);
           55 +                        drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
           56                  }
           57          }
           58          drw_map(drw, m->barwin, 0, 0, m->ww, bh);
           59 @@ -1563,6 +1565,9 @@ setup(void)
           60          lrpad = drw->fonts->h;
           61          bh = drw->fonts->h + 2;
           62          updategeom();
           63 +        sp = sidepad;
           64 +        vp = (topbar == 1) ? vertpad : - vertpad;
           65 +
           66          /* init atoms */
           67          utf8string = XInternAtom(dpy, "UTF8_STRING", False);
           68          wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
           69 @@ -1589,6 +1594,7 @@ setup(void)
           70          /* init bars */
           71          updatebars();
           72          updatestatus();
           73 +        updatebarpos(selmon);
           74          /* supporting window for NetWMCheck */
           75          wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
           76          XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
           77 @@ -1716,7 +1722,7 @@ togglebar(const Arg *arg)
           78  {
           79          selmon->showbar = !selmon->showbar;
           80          updatebarpos(selmon);
           81 -        XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
           82 +        XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh);
           83          arrange(selmon);
           84  }
           85 
           86 @@ -1827,7 +1833,7 @@ updatebars(void)
           87          for (m = mons; m; m = m->next) {
           88                  if (m->barwin)
           89                          continue;
           90 -                m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
           91 +                m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, DefaultDepth(dpy, screen),
           92                                  CopyFromParent, DefaultVisual(dpy, screen),
           93                                  CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
           94                  XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
           95 @@ -1842,11 +1848,11 @@ updatebarpos(Monitor *m)
           96          m->wy = m->my;
           97          m->wh = m->mh;
           98          if (m->showbar) {
           99 -                m->wh -= bh;
          100 -                m->by = m->topbar ? m->wy : m->wy + m->wh;
          101 -                m->wy = m->topbar ? m->wy + bh : m->wy;
          102 +                m->wh = m->wh - vertpad - bh;
          103 +                m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad;
          104 +                m->wy = m->topbar ? m->wy + bh + vp : m->wy;
          105          } else
          106 -                m->by = -bh;
          107 +                m->by = -bh - vp;
          108  }
          109 
          110  void
          111 @@ -2162,3 +2168,4 @@ main(int argc, char *argv[])
          112          XCloseDisplay(dpy);
          113          return EXIT_SUCCESS;
          114  }
          115 +