bakkeby / patches

Collection of patches for dwm, st and dmenu
286 stars 30 forks source link

Barpadding patch with status2d #44

Closed twoeightdev closed 2 years ago

twoeightdev commented 2 years ago

Hi, i apply your barpadding patch, but i think it has conflict with status2d. the patch doesn't throw any errors but the colors in status2d got broken, it is working before i add the barpadding patch. im using vanilla dwm 6.3. thank you sir

bakkeby commented 2 years ago

Yes pretty much everyone who tries to include a combination of barpadding, status2d and/or systray run into many forms of issues.

I can only recommend trying to patch the barpadding patch manually, it is a relatively small patch.

The status2d patch moves the drawing of the status to the drawstatusbar function so the side padding that the barpadding patch adds should be taken into account here.

Have a closer look at this line:

   ret = x = m->ww - w;

x should be where it starts to draw, whereas ret is the returned value.

The way the returned value is used is to derive the text width, again calculated by calculating against the monitor window area width (m->ww) in drawbar.

       tw = m->ww - drawstatusbar(m, bh, stext);

It is a lot saner to just return the width of the status in drawstatusbar rather than trying to do calculations like this.

In drawstatusbar perhaps you should have this instead:

ret = w;
x = m->ww - w - 2 * sp;

and in drawbar:

       tw = drawstatusbar(m, bh, stext);
twoeightdev commented 2 years ago

i did try to add like this but it status2d is still broken.

@@ -709,7 +711,7 @@ drawbar(Monitor *m)
    if (m == selmon) { /* status is only drawn on selected monitor */
        drw_setscheme(drw, scheme[SchemeNorm]);
-       tw = m->ww - drawstatusbar(m, bh, stext);
+       tw = drawstatusbar(m, bh, stext);
-       drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
+       drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0);

then in drawstatusbar just like you said

drawstatusbar(Monitor *m, int bh, char* stext) {
    w += horizpadbar;
-    ret = x = m->ww - w;
+   ret = w;
+   x = m->ww - w - 2 * sp;

btw im using this dwm-barpadding-6.3.diff of yours, i just add those what you've said.

bakkeby commented 2 years ago

But why are you adding

drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0);
bakkeby commented 2 years ago

I mean you shouldn't have both drawstatusbar and drw_text.

twoeightdev commented 2 years ago

I mean you shouldn't have both drawstatusbar and drw_text.

sorry sir i dont have enough knowledge of C. i'll try it again sir and report back. thank you

twoeightdev commented 2 years ago

it is working now sir. thank you 😊