commit eccb7bf34b9ea179157e8d80312a4c2eec73ab7c
Author: aleks <[email protected]>
Date:   Tue May 14 20:53:30 2019 +0200

    [dwm][patch] Add nostatusbar-patch

diff --git a/dwm.suckless.org/patches/nostatusbar/dwm-nostatusbar-6.2.diff 
b/dwm.suckless.org/patches/nostatusbar/dwm-nostatusbar-6.2.diff
new file mode 100644
index 00000000..613d6301
--- /dev/null
+++ b/dwm.suckless.org/patches/nostatusbar/dwm-nostatusbar-6.2.diff
@@ -0,0 +1,939 @@
+From 7825198bde9179fa7820c39a587fec3c015d70b1 Mon Sep 17 00:00:00 2001
+From: aleks <[email protected]>
+Date: Sat, 6 Apr 2019 23:49:02 +0200
+Subject: [PATCH] Remove statusbar and all related code
+
+Remove statusbar-related code from dwm (more than 500 lines).
+If you find any code which I forgot to remove feel free to contact me
+and/or upload an updated version of this pactch.
+---
+ config.def.h |  32 ++----
+ drw.c        | 304 ---------------------------------------------------
+ drw.h        |   8 --
+ dwm.c        | 207 +----------------------------------
+ 4 files changed, 17 insertions(+), 534 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..28534dc 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -3,21 +3,19 @@
+ /* appearance */
+ static const unsigned int borderpx  = 1;        /* border pixel of windows */
+ static const unsigned int snap      = 32;       /* snap pixel */
+-static const int showbar            = 1;        /* 0 means no bar */
+-static const int topbar             = 1;        /* 0 means bottom bar */
+-static const char *fonts[]          = { "monospace:size=10" };
+ static const char dmenufont[]       = "monospace:size=10";
+-static const char col_gray1[]       = "#222222";
+-static const char col_gray2[]       = "#444444";
+-static const char col_gray3[]       = "#bbbbbb";
+-static const char col_gray4[]       = "#eeeeee";
+-static const char col_cyan[]        = "#005577";
++static const char border_color_norm[] = "#444444";
++static const char border_color_sel[]  = "#005577";
++
++/* TODO remove dummy_color */
++static const char dummy_color[]       = "#222222";
+ static const char *colors[][3]      = {
+       /*               fg         bg         border   */
+-      [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
+-      [SchemeSel]  = { col_gray4, col_cyan,  col_cyan  },
++      [SchemeNorm] = { dummy_color, dummy_color, border_color_norm },
++      [SchemeSel]  = { dummy_color, dummy_color, border_color_sel },
+ };
+ 
++/* TODO replace array with int */
+ /* tagging */
+ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+ 
+@@ -36,6 +34,7 @@ static const float mfact     = 0.55; /* factor of master 
area size [0.05..0.95]
+ static const int nmaster     = 1;    /* number of clients in master area */
+ static const int resizehints = 1;    /* 1 means respect size hints in tiled 
resizals */
+ 
++/* TODO remove symbols */
+ static const Layout layouts[] = {
+       /* symbol     arrange function */
+       { "[]=",      tile },    /* first entry is default */
+@@ -56,14 +55,13 @@ static const Layout layouts[] = {
+ 
+ /* commands */
+ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in 
spawn() */
+-static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", 
dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", 
col_gray4, NULL };
++static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", 
dmenufont, "-nb", NULL };
+ static const char *termcmd[]  = { "st", NULL };
+ 
+ static Key keys[] = {
+       /* modifier                     key        function        argument */
+       { MODKEY,                       XK_p,      spawn,          {.v = 
dmenucmd } },
+       { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = 
termcmd } },
+-      { MODKEY,                       XK_b,      togglebar,      {0} },
+       { MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
+       { MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
+       { MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
+@@ -97,19 +95,11 @@ static Key keys[] = {
+ };
+ 
+ /* button definitions */
+-/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, 
ClkClientWin, or ClkRootWin */
++/* click can be ClkClientWin or ClkRootWin */
+ static Button buttons[] = {
+       /* click                event mask      button          function        
argument */
+-      { ClkLtSymbol,          0,              Button1,        setlayout,      
{0} },
+-      { ClkLtSymbol,          0,              Button3,        setlayout,      
{.v = &layouts[2]} },
+-      { ClkWinTitle,          0,              Button2,        zoom,           
{0} },
+-      { ClkStatusText,        0,              Button2,        spawn,          
{.v = termcmd } },
+       { ClkClientWin,         MODKEY,         Button1,        movemouse,      
{0} },
+       { ClkClientWin,         MODKEY,         Button2,        togglefloating, 
{0} },
+       { ClkClientWin,         MODKEY,         Button3,        resizemouse,    
{0} },
+-      { ClkTagBar,            0,              Button1,        view,           
{0} },
+-      { ClkTagBar,            0,              Button3,        toggleview,     
{0} },
+-      { ClkTagBar,            MODKEY,         Button1,        tag,            
{0} },
+-      { ClkTagBar,            MODKEY,         Button3,        toggletag,      
{0} },
+ };
+ 
+diff --git a/drw.c b/drw.c
+index 8fd1ca4..c9b796f 100644
+--- a/drw.c
++++ b/drw.c
+@@ -11,55 +11,6 @@
+ #define UTF_INVALID 0xFFFD
+ #define UTF_SIZ     4
+ 
+-static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80,    0, 0xC0, 0xE0, 
0xF0};
+-static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 
0xF8};
+-static const long utfmin[UTF_SIZ + 1] = {       0,    0,  0x80,  0x800,  
0x10000};
+-static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 
0x10FFFF};
+-
+-static long
+-utf8decodebyte(const char c, size_t *i)
+-{
+-      for (*i = 0; *i < (UTF_SIZ + 1); ++(*i))
+-              if (((unsigned char)c & utfmask[*i]) == utfbyte[*i])
+-                      return (unsigned char)c & ~utfmask[*i];
+-      return 0;
+-}
+-
+-static size_t
+-utf8validate(long *u, size_t i)
+-{
+-      if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
+-              *u = UTF_INVALID;
+-      for (i = 1; *u > utfmax[i]; ++i)
+-              ;
+-      return i;
+-}
+-
+-static size_t
+-utf8decode(const char *c, long *u, size_t clen)
+-{
+-      size_t i, j, len, type;
+-      long udecoded;
+-
+-      *u = UTF_INVALID;
+-      if (!clen)
+-              return 0;
+-      udecoded = utf8decodebyte(c[0], &len);
+-      if (!BETWEEN(len, 1, UTF_SIZ))
+-              return 1;
+-      for (i = 1, j = 1; i < clen && j < len; ++i, ++j) {
+-              udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type);
+-              if (type)
+-                      return j;
+-      }
+-      if (j < len)
+-              return 0;
+-      *u = udecoded;
+-      utf8validate(u, len);
+-
+-      return len;
+-}
+-
+ Drw *
+ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned 
int h)
+ {
+@@ -98,100 +49,6 @@ drw_free(Drw *drw)
+       free(drw);
+ }
+ 
+-/* This function is an implementation detail. Library users should use
+- * drw_fontset_create instead.
+- */
+-static Fnt *
+-xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
+-{
+-      Fnt *font;
+-      XftFont *xfont = NULL;
+-      FcPattern *pattern = NULL;
+-
+-      if (fontname) {
+-              /* Using the pattern found at font->xfont->pattern does not 
yield the
+-               * same substitution results as using the pattern returned by
+-               * FcNameParse; using the latter results in the desired fallback
+-               * behaviour whereas the former just results in 
missing-character
+-               * rectangles being drawn, at least with some fonts. */
+-              if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, 
fontname))) {
+-                      fprintf(stderr, "error, cannot load font from name: '%s'
", fontname);
+-                      return NULL;
+-              }
+-              if (!(pattern = FcNameParse((FcChar8 *) fontname))) {
+-                      fprintf(stderr, "error, cannot parse font name to 
pattern: '%s'
", fontname);
+-                      XftFontClose(drw->dpy, xfont);
+-                      return NULL;
+-              }
+-      } else if (fontpattern) {
+-              if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) {
+-                      fprintf(stderr, "error, cannot load font from pattern.
");
+-                      return NULL;
+-              }
+-      } else {
+-              die("no font specified.");
+-      }
+-
+-      /* Do not allow using color fonts. This is a workaround for a BadLength
+-       * error from Xft with color glyphs. Modelled on the Xterm workaround. 
See
+-       * https://bugzilla.redhat.com/show_bug.cgi?id=1498269
+-       * https://lists.suckless.org/dev/1701/30932.html
+-       * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
+-       * and lots more all over the internet.
+-       */
+-      FcBool iscol;
+-      if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == 
FcResultMatch && iscol) {
+-              XftFontClose(drw->dpy, xfont);
+-              return NULL;
+-      }
+-
+-      font = ecalloc(1, sizeof(Fnt));
+-      font->xfont = xfont;
+-      font->pattern = pattern;
+-      font->h = xfont->ascent + xfont->descent;
+-      font->dpy = drw->dpy;
+-
+-      return font;
+-}
+-
+-static void
+-xfont_free(Fnt *font)
+-{
+-      if (!font)
+-              return;
+-      if (font->pattern)
+-              FcPatternDestroy(font->pattern);
+-      XftFontClose(font->dpy, font->xfont);
+-      free(font);
+-}
+-
+-Fnt*
+-drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
+-{
+-      Fnt *cur, *ret = NULL;
+-      size_t i;
+-
+-      if (!drw || !fonts)
+-              return NULL;
+-
+-      for (i = 1; i <= fontcount; i++) {
+-              if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) {
+-                      cur->next = ret;
+-                      ret = cur;
+-              }
+-      }
+-      return (drw->fonts = ret);
+-}
+-
+-void
+-drw_fontset_free(Fnt *font)
+-{
+-      if (font) {
+-              drw_fontset_free(font->next);
+-              xfont_free(font);
+-      }
+-}
+-
+ void
+ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
+ {
+@@ -221,13 +78,6 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t 
clrcount)
+       return ret;
+ }
+ 
+-void
+-drw_setfontset(Drw *drw, Fnt *set)
+-{
+-      if (drw)
+-              drw->fonts = set;
+-}
+-
+ void
+ drw_setscheme(Drw *drw, Clr *scm)
+ {
+@@ -247,137 +97,6 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned 
int h, int filled, int
+               XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h 
- 1);
+ }
+ 
+-int
+-drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int 
lpad, const char *text, int invert)
+-{
+-      char buf[1024];
+-      int ty;
+-      unsigned int ew;
+-      XftDraw *d = NULL;
+-      Fnt *usedfont, *curfont, *nextfont;
+-      size_t i, len;
+-      int utf8strlen, utf8charlen, render = x || y || w || h;
+-      long utf8codepoint = 0;
+-      const char *utf8str;
+-      FcCharSet *fccharset;
+-      FcPattern *fcpattern;
+-      FcPattern *match;
+-      XftResult result;
+-      int charexists = 0;
+-
+-      if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
+-              return 0;
+-
+-      if (!render) {
+-              w = ~w;
+-      } else {
+-              XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : 
ColBg].pixel);
+-              XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
+-              d = XftDrawCreate(drw->dpy, drw->drawable,
+-                                DefaultVisual(drw->dpy, drw->screen),
+-                                DefaultColormap(drw->dpy, drw->screen));
+-              x += lpad;
+-              w -= lpad;
+-      }
+-
+-      usedfont = drw->fonts;
+-      while (1) {
+-              utf8strlen = 0;
+-              utf8str = text;
+-              nextfont = NULL;
+-              while (*text) {
+-                      utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
+-                      for (curfont = drw->fonts; curfont; curfont = 
curfont->next) {
+-                              charexists = charexists || 
XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
+-                              if (charexists) {
+-                                      if (curfont == usedfont) {
+-                                              utf8strlen += utf8charlen;
+-                                              text += utf8charlen;
+-                                      } else {
+-                                              nextfont = curfont;
+-                                      }
+-                                      break;
+-                              }
+-                      }
+-
+-                      if (!charexists || nextfont)
+-                              break;
+-                      else
+-                              charexists = 0;
+-              }
+-
+-              if (utf8strlen) {
+-                      drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, 
NULL);
+-                      /* shorten text if necessary */
+-                      for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew 
> w; len--)
+-                              drw_font_getexts(usedfont, utf8str, len, &ew, 
NULL);
+-
+-                      if (len) {
+-                              memcpy(buf, utf8str, len);
+-                              buf[len] = '+-                          if (len 
< utf8strlen)
+-                                      for (i = len; i && i > len - 3; 
buf[--i] = '.')
+-                                              ; /* NOP */
+-
+-                              if (render) {
+-                                      ty = y + (h - usedfont->h) / 2 + 
usedfont->xfont->ascent;
+-                                      XftDrawStringUtf8(d, 
&drw->scheme[invert ? ColBg : ColFg],
+-                                                        usedfont->xfont, x, 
ty, (XftChar8 *)buf, len);
+-                              }
+-                              x += ew;
+-                              w -= ew;
+-                      }
+-              }
+-
+-              if (!*text) {
+-                      break;
+-              } else if (nextfont) {
+-                      charexists = 0;
+-                      usedfont = nextfont;
+-              } else {
+-                      /* Regardless of whether or not a fallback font is 
found, the
+-                       * character must be drawn. */
+-                      charexists = 1;
+-
+-                      fccharset = FcCharSetCreate();
+-                      FcCharSetAddChar(fccharset, utf8codepoint);
+-
+-                      if (!drw->fonts->pattern) {
+-                              /* Refer to the comment in xfont_create for 
more information. */
+-                              die("the first font in the cache must be loaded 
from a font string.");
+-                      }
+-
+-                      fcpattern = FcPatternDuplicate(drw->fonts->pattern);
+-                      FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
+-                      FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
+-                      FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
+-
+-                      FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
+-                      FcDefaultSubstitute(fcpattern);
+-                      match = XftFontMatch(drw->dpy, drw->screen, fcpattern, 
&result);
+-
+-                      FcCharSetDestroy(fccharset);
+-                      FcPatternDestroy(fcpattern);
+-
+-                      if (match) {
+-                              usedfont = xfont_create(drw, NULL, match);
+-                              if (usedfont && XftCharExists(drw->dpy, 
usedfont->xfont, utf8codepoint)) {
+-                                      for (curfont = drw->fonts; 
curfont->next; curfont = curfont->next)
+-                                              ; /* NOP */
+-                                      curfont->next = usedfont;
+-                              } else {
+-                                      xfont_free(usedfont);
+-                                      usedfont = drw->fonts;
+-                              }
+-                      }
+-              }
+-      }
+-      if (d)
+-              XftDrawDestroy(d);
+-
+-      return x + (render ? w : 0);
+-}
+-
+ void
+ drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
+ {
+@@ -388,29 +107,6 @@ drw_map(Drw *drw, Window win, int x, int y, unsigned int 
w, unsigned int h)
+       XSync(drw->dpy, False);
+ }
+ 
+-unsigned int
+-drw_fontset_getwidth(Drw *drw, const char *text)
+-{
+-      if (!drw || !drw->fonts || !text)
+-              return 0;
+-      return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
+-}
+-
+-void
+-drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int 
*w, unsigned int *h)
+-{
+-      XGlyphInfo ext;
+-
+-      if (!font || !text)
+-              return;
+-
+-      XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext);
+-      if (w)
+-              *w = ext.xOff;
+-      if (h)
+-              *h = font->h;
+-}
+-
+ Cur *
+ drw_cur_create(Drw *drw, int shape)
+ {
+diff --git a/drw.h b/drw.h
+index 4bcd5ad..0f73b59 100644
+--- a/drw.h
++++ b/drw.h
+@@ -31,12 +31,6 @@ Drw *drw_create(Display *dpy, int screen, Window win, 
unsigned int w, unsigned i
+ void drw_resize(Drw *drw, unsigned int w, unsigned int h);
+ void drw_free(Drw *drw);
+ 
+-/* Fnt abstraction */
+-Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
+-void drw_fontset_free(Fnt* set);
+-unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
+-void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned 
int *w, unsigned int *h);
+-
+ /* Colorscheme abstraction */
+ void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
+ Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
+@@ -46,12 +40,10 @@ Cur *drw_cur_create(Drw *drw, int shape);
+ void drw_cur_free(Drw *drw, Cur *cursor);
+ 
+ /* Drawing context manipulation */
+-void drw_setfontset(Drw *drw, Fnt *set);
+ void drw_setscheme(Drw *drw, Clr *scm);
+ 
+ /* Drawing functions */
+ void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int 
filled, int invert);
+-int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned 
int lpad, const char *text, int invert);
+ 
+ /* Map functions */
+ void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int 
h);
+diff --git a/dwm.c b/dwm.c
+index 4465af1..2e41a5b 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -55,7 +55,6 @@
+ #define WIDTH(X)                ((X)->w + 2 * (X)->bw)
+ #define HEIGHT(X)               ((X)->h + 2 * (X)->bw)
+ #define TAGMASK                 ((1 << LENGTH(tags)) - 1)
+-#define TEXTW(X)                (drw_fontset_getwidth(drw, (X)) + lrpad)
+ 
+ /* enums */
+ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+@@ -64,8 +63,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
+        NetWMFullscreen, NetActiveWindow, NetWMWindowType,
+        NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default 
atoms */
+-enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
+-       ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
++enum { ClkClientWin, ClkRootWin }; /* clicks */
+ 
+ typedef union {
+       int i;
+@@ -116,19 +114,15 @@ struct Monitor {
+       float mfact;
+       int nmaster;
+       int num;
+-      int by;               /* bar geometry */
+       int mx, my, mw, mh;   /* screen size */
+       int wx, wy, ww, wh;   /* window area  */
+       unsigned int seltags;
+       unsigned int sellt;
+       unsigned int tagset[2];
+-      int showbar;
+-      int topbar;
+       Client *clients;
+       Client *sel;
+       Client *stack;
+       Monitor *next;
+-      Window barwin;
+       const Layout *lt[2];
+ };
+ 
+@@ -161,10 +155,7 @@ static void destroynotify(XEvent *e);
+ static void detach(Client *c);
+ static void detachstack(Client *c);
+ static Monitor *dirtomon(int dir);
+-static void drawbar(Monitor *m);
+-static void drawbars(void);
+ static void enternotify(XEvent *e);
+-static void expose(XEvent *e);
+ static void focus(Client *c);
+ static void focusin(XEvent *e);
+ static void focusmon(const Arg *arg);
+@@ -209,20 +200,16 @@ static void spawn(const Arg *arg);
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static void tile(Monitor *);
+-static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, int setfocus);
+ static void unmanage(Client *c, int destroyed);
+ static void unmapnotify(XEvent *e);
+-static void updatebarpos(Monitor *m);
+-static void updatebars(void);
+ static void updateclientlist(void);
+ static int updategeom(void);
+ static void updatenumlockmask(void);
+ static void updatesizehints(Client *c);
+-static void updatestatus(void);
+ static void updatetitle(Client *c);
+ static void updatewindowtype(Client *c);
+ static void updatewmhints(Client *c);
+@@ -236,11 +223,8 @@ static void zoom(const Arg *arg);
+ 
+ /* variables */
+ static const char broken[] = "broken";
+-static char stext[256];
+ static int screen;
+ static int sw, sh;           /* X display screen geometry width, height */
+-static int bh, blw = 0;      /* bar geometry */
+-static int lrpad;            /* sum of left and right padding for text */
+ static int (*xerrorxlib)(Display *, XErrorEvent *);
+ static unsigned int numlockmask = 0;
+ static void (*handler[LASTEvent]) (XEvent *) = {
+@@ -250,7 +234,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
+       [ConfigureNotify] = configurenotify,
+       [DestroyNotify] = destroynotify,
+       [EnterNotify] = enternotify,
+-      [Expose] = expose,
+       [FocusIn] = focusin,
+       [KeyPress] = keypress,
+       [MappingNotify] = mappingnotify,
+@@ -339,10 +322,6 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, 
int interact)
+               if (*y + *h + 2 * c->bw <= m->wy)
+                       *y = m->wy;
+       }
+-      if (*h < bh)
+-              *h = bh;
+-      if (*w < bh)
+-              *w = bh;
+       if (resizehints || c->isfloating || 
!c->mon->lt[c->mon->sellt]->arrange) {
+               /* see last two sentences in ICCCM 4.1.2.3 */
+               baseismin = c->basew == c->minw && c->baseh == c->minh;
+@@ -416,8 +395,7 @@ attachstack(Client *c)
+ void
+ buttonpress(XEvent *e)
+ {
+-      unsigned int i, x, click;
+-      Arg arg = {0};
++      unsigned int i, click;
+       Client *c;
+       Monitor *m;
+       XButtonPressedEvent *ev = &e->xbutton;
+@@ -429,21 +407,7 @@ buttonpress(XEvent *e)
+               selmon = m;
+               focus(NULL);
+       }
+-      if (ev->window == selmon->barwin) {
+-              i = x = 0;
+-              do
+-                      x += TEXTW(tags[i]);
+-              while (ev->x >= x && ++i < LENGTH(tags));
+-              if (i < LENGTH(tags)) {
+-                      click = ClkTagBar;
+-                      arg.ui = 1 << i;
+-              } else if (ev->x < x + blw)
+-                      click = ClkLtSymbol;
+-              else if (ev->x > selmon->ww - TEXTW(stext))
+-                      click = ClkStatusText;
+-              else
+-                      click = ClkWinTitle;
+-      } else if ((c = wintoclient(ev->window))) {
++      if ((c = wintoclient(ev->window))) {
+               focus(c);
+               restack(selmon);
+               XAllowEvents(dpy, ReplayPointer, CurrentTime);
+@@ -452,7 +416,7 @@ buttonpress(XEvent *e)
+       for (i = 0; i < LENGTH(buttons); i++)
+               if (click == buttons[i].click && buttons[i].func && 
buttons[i].button == ev->button
+               && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
+-                      buttons[i].func(click == ClkTagBar && buttons[i].arg.i 
== 0 ? &arg : &buttons[i].arg);
++                      buttons[i].func(&buttons[i].arg);
+ }
+ 
+ void
+@@ -504,8 +468,6 @@ cleanupmon(Monitor *mon)
+               for (m = mons; m && m->next != mon; m = m->next);
+               m->next = mon->next;
+       }
+-      XUnmapWindow(dpy, mon->barwin);
+-      XDestroyWindow(dpy, mon->barwin);
+       free(mon);
+ }
+ 
+@@ -561,13 +523,11 @@ configurenotify(XEvent *e)
+               sw = ev->width;
+               sh = ev->height;
+               if (updategeom() || dirty) {
+-                      drw_resize(drw, sw, bh);
+-                      updatebars();
++                      drw_resize(drw, sw, sh);
+                       for (m = mons; m; m = m->next) {
+                               for (c = m->clients; c; c = c->next)
+                                       if (c->isfullscreen)
+                                               resizeclient(c, m->mx, m->my, 
m->mw, m->mh);
+-                              XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, 
m->ww, bh);
+                       }
+                       focus(NULL);
+                       arrange(NULL);
+@@ -636,8 +596,6 @@ createmon(void)
+       m->tagset[0] = m->tagset[1] = 1;
+       m->mfact = mfact;
+       m->nmaster = nmaster;
+-      m->showbar = showbar;
+-      m->topbar = topbar;
+       m->lt[0] = &layouts[0];
+       m->lt[1] = &layouts[1 % LENGTH(layouts)];
+       strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
+@@ -692,65 +650,6 @@ dirtomon(int dir)
+       return m;
+ }
+ 
+-void
+-drawbar(Monitor *m)
+-{
+-      int x, w, sw = 0;
+-      int boxs = drw->fonts->h / 9;
+-      int boxw = drw->fonts->h / 6 + 2;
+-      unsigned int i, occ = 0, urg = 0;
+-      Client *c;
+-
+-      /* draw status first so it can be overdrawn by tags later */
+-      if (m == selmon) { /* status is only drawn on selected monitor */
+-              drw_setscheme(drw, scheme[SchemeNorm]);
+-              sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
+-              drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
+-      }
+-
+-      for (c = m->clients; c; c = c->next) {
+-              occ |= c->tags;
+-              if (c->isurgent)
+-                      urg |= c->tags;
+-      }
+-      x = 0;
+-      for (i = 0; i < LENGTH(tags); i++) {
+-              w = TEXTW(tags[i]);
+-              drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? 
SchemeSel : SchemeNorm]);
+-              drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
+-              if (occ & 1 << i)
+-                      drw_rect(drw, x + boxs, boxs, boxw, boxw,
+-                              m == selmon && selmon->sel && selmon->sel->tags 
& 1 << i,
+-                              urg & 1 << i);
+-              x += w;
+-      }
+-      w = blw = TEXTW(m->ltsymbol);
+-      drw_setscheme(drw, scheme[SchemeNorm]);
+-      x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
+-
+-      if ((w = m->ww - sw - x) > bh) {
+-              if (m->sel) {
+-                      drw_setscheme(drw, scheme[m == selmon ? SchemeSel : 
SchemeNorm]);
+-                      drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
+-                      if (m->sel->isfloating)
+-                              drw_rect(drw, x + boxs, boxs, boxw, boxw, 
m->sel->isfixed, 0);
+-              } else {
+-                      drw_setscheme(drw, scheme[SchemeNorm]);
+-                      drw_rect(drw, x, 0, w, bh, 1, 1);
+-              }
+-      }
+-      drw_map(drw, m->barwin, 0, 0, m->ww, bh);
+-}
+-
+-void
+-drawbars(void)
+-{
+-      Monitor *m;
+-
+-      for (m = mons; m; m = m->next)
+-              drawbar(m);
+-}
+-
+ void
+ enternotify(XEvent *e)
+ {
+@@ -770,16 +669,6 @@ enternotify(XEvent *e)
+       focus(c);
+ }
+ 
+-void
+-expose(XEvent *e)
+-{
+-      Monitor *m;
+-      XExposeEvent *ev = &e->xexpose;
+-
+-      if (ev->count == 0 && (m = wintomon(ev->window)))
+-              drawbar(m);
+-}
+-
+ void
+ focus(Client *c)
+ {
+@@ -802,7 +691,6 @@ focus(Client *c)
+               XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
+       }
+       selmon->sel = c;
+-      drawbars();
+ }
+ 
+ /* there are some broken focus acquiring clients needing extra handling */
+@@ -1044,9 +932,6 @@ manage(Window w, XWindowAttributes *wa)
+       if (c->y + HEIGHT(c) > c->mon->my + c->mon->mh)
+               c->y = c->mon->my + c->mon->mh - HEIGHT(c);
+       c->x = MAX(c->x, c->mon->mx);
+-      /* only fix client y-offset, if the client center might cover the bar */
+-      c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= 
c->mon->wx)
+-              && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : 
c->mon->my);
+       c->bw = borderpx;
+ 
+       wc.border_width = c->bw;
+@@ -1103,14 +988,8 @@ maprequest(XEvent *e)
+ void
+ monocle(Monitor *m)
+ {
+-      unsigned int n = 0;
+       Client *c;
+ 
+-      for (c = m->clients; c; c = c->next)
+-              if (ISVISIBLE(c))
+-                      n++;
+-      if (n > 0) /* override layout symbol */
+-              snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
+       for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
+               resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 
0);
+ }
+@@ -1215,9 +1094,7 @@ propertynotify(XEvent *e)
+       Window trans;
+       XPropertyEvent *ev = &e->xproperty;
+ 
+-      if ((ev->window == root) && (ev->atom == XA_WM_NAME))
+-              updatestatus();
+-      else if (ev->state == PropertyDelete)
++      if (ev->state == PropertyDelete)
+               return; /* ignore */
+       else if ((c = wintoclient(ev->window))) {
+               switch(ev->atom) {
+@@ -1232,13 +1109,10 @@ propertynotify(XEvent *e)
+                       break;
+               case XA_WM_HINTS:
+                       updatewmhints(c);
+-                      drawbars();
+                       break;
+               }
+               if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
+                       updatetitle(c);
+-                      if (c == c->mon->sel)
+-                              drawbar(c->mon);
+               }
+               if (ev->atom == netatom[NetWMWindowType])
+                       updatewindowtype(c);
+@@ -1351,14 +1225,12 @@ restack(Monitor *m)
+       XEvent ev;
+       XWindowChanges wc;
+ 
+-      drawbar(m);
+       if (!m->sel)
+               return;
+       if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
+               XRaiseWindow(dpy, m->sel->win);
+       if (m->lt[m->sellt]->arrange) {
+               wc.stack_mode = Below;
+-              wc.sibling = m->barwin;
+               for (c = m->stack; c; c = c->snext)
+                       if (!c->isfloating && ISVISIBLE(c)) {
+                               XConfigureWindow(dpy, c->win, 
CWSibling|CWStackMode, &wc);
+@@ -1507,8 +1379,6 @@ setlayout(const Arg *arg)
+       strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof 
selmon->ltsymbol);
+       if (selmon->sel)
+               arrange(selmon);
+-      else
+-              drawbar(selmon);
+ }
+ 
+ /* arg > 1.0 will set mfact absolutely */
+@@ -1542,10 +1412,6 @@ setup(void)
+       sh = DisplayHeight(dpy, screen);
+       root = RootWindow(dpy, screen);
+       drw = drw_create(dpy, screen, root, sw, sh);
+-      if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
+-              die("no fonts could be loaded.");
+-      lrpad = drw->fonts->h;
+-      bh = drw->fonts->h + 2;
+       updategeom();
+       /* init atoms */
+       utf8string = XInternAtom(dpy, "UTF8_STRING", False);
+@@ -1570,9 +1436,6 @@ setup(void)
+       scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
+       for (i = 0; i < LENGTH(colors); i++)
+               scheme[i] = drw_scm_create(drw, colors[i], 3);
+-      /* init bars */
+-      updatebars();
+-      updatestatus();
+       /* supporting window for NetWMCheck */
+       wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
+       XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
+@@ -1696,15 +1559,6 @@ tile(Monitor *m)
+               }
+ }
+ 
+-void
+-togglebar(const Arg *arg)
+-{
+-      selmon->showbar = !selmon->showbar;
+-      updatebarpos(selmon);
+-      XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, 
selmon->ww, bh);
+-      arrange(selmon);
+-}
+-
+ void
+ togglefloating(const Arg *arg)
+ {
+@@ -1798,41 +1652,6 @@ unmapnotify(XEvent *e)
+       }
+ }
+ 
+-void
+-updatebars(void)
+-{
+-      Monitor *m;
+-      XSetWindowAttributes wa = {
+-              .override_redirect = True,
+-              .background_pixmap = ParentRelative,
+-              .event_mask = ButtonPressMask|ExposureMask
+-      };
+-      XClassHint ch = {"dwm", "dwm"};
+-      for (m = mons; m; m = m->next) {
+-              if (m->barwin)
+-                      continue;
+-              m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 
0, DefaultDepth(dpy, screen),
+-                              CopyFromParent, DefaultVisual(dpy, screen),
+-                              CWOverrideRedirect|CWBackPixmap|CWEventMask, 
&wa);
+-              XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
+-              XMapRaised(dpy, m->barwin);
+-              XSetClassHint(dpy, m->barwin, &ch);
+-      }
+-}
+-
+-void
+-updatebarpos(Monitor *m)
+-{
+-      m->wy = m->my;
+-      m->wh = m->mh;
+-      if (m->showbar) {
+-              m->wh -= bh;
+-              m->by = m->topbar ? m->wy : m->wy + m->wh;
+-              m->wy = m->topbar ? m->wy + bh : m->wy;
+-      } else
+-              m->by = -bh;
+-}
+-
+ void
+ updateclientlist()
+ {
+@@ -1887,7 +1706,6 @@ updategeom(void)
+                                       m->my = m->wy = unique[i].y_org;
+                                       m->mw = m->ww = unique[i].width;
+                                       m->mh = m->wh = unique[i].height;
+-                                      updatebarpos(m);
+                               }
+               } else { /* less monitors available nn < n */
+                       for (i = nn; i < n; i++) {
+@@ -1915,7 +1733,6 @@ updategeom(void)
+                       dirty = 1;
+                       mons->mw = mons->ww = sw;
+                       mons->mh = mons->wh = sh;
+-                      updatebarpos(mons);
+               }
+       }
+       if (dirty) {
+@@ -1984,14 +1801,6 @@ updatesizehints(Client *c)
+       c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == 
c->minh);
+ }
+ 
+-void
+-updatestatus(void)
+-{
+-      if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
+-              strcpy(stext, "dwm-"VERSION);
+-      drawbar(selmon);
+-}
+-
+ void
+ updatetitle(Client *c)
+ {
+@@ -2062,13 +1871,9 @@ wintomon(Window w)
+ {
+       int x, y;
+       Client *c;
+-      Monitor *m;
+ 
+       if (w == root && getrootptr(&x, &y))
+               return recttomon(x, y, 1, 1);
+-      for (m = mons; m; m = m->next)
+-              if (w == m->barwin)
+-                      return m;
+       if ((c = wintoclient(w)))
+               return c->mon;
+       return selmon;
+-- 
+2.21.0
+
diff --git a/dwm.suckless.org/patches/nostatusbar/index.md 
b/dwm.suckless.org/patches/nostatusbar/index.md
new file mode 100644
index 00000000..9a06f334
--- /dev/null
+++ b/dwm.suckless.org/patches/nostatusbar/index.md
@@ -0,0 +1,16 @@
+nostatusbar
+===========
+
+Description
+-----------
+Remove statusbar-related code from dwm (more than 500 lines).
+If you find any code which I forgot to remove feel free to contact me
+and/or upload an updated version of this pactch.
+
+Download
+--------
+* [dwm-nostatusbar-6.2.diff](dwm-nostatusbar-6.2.diff)
+
+Author
+------
+* Aleksandrs Stier


Reply via email to