Compare commits

..

1 Commits

Author SHA1 Message Date
Jakub
8770c7b878 resize corners patch 2024-05-17 06:31:23 -04:00
3 changed files with 11 additions and 55 deletions

View File

@ -33,11 +33,6 @@ static const unsigned int alphas[][3] = {
/* tagging */ /* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
static const Rule rules[] = { static const Rule rules[] = {
/* xprop(1): /* xprop(1):
* WM_CLASS(STRING) = instance, class * WM_CLASS(STRING) = instance, class

26
dwm.c
View File

@ -888,8 +888,6 @@ drawbar(Monitor *m)
w = TEXTW(tags[i]); w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); 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); drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
if (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
if (occ & 1 << i) if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw, drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
@ -1700,11 +1698,12 @@ resizemouse(const Arg *arg)
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess) None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
return; return;
// should be in the if, but i want gcc to stfu
horizcorner = nx < c->w / 2;
vertcorner = ny < c->h / 2;
if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) { if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui)) if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui))
return; return;
horizcorner = nx < c->w / 2;
vertcorner = ny < c->h / 2;
XWarpPointer (dpy, None, c->win, 0, 0, 0, 0, XWarpPointer (dpy, None, c->win, 0, 0, 0, 0,
horizcorner ? (-c->bw) : (c->w + c->bw -1), horizcorner ? (-c->bw) : (c->w + c->bw -1),
vertcorner ? (-c->bw) : (c->h + c->bw -1)); vertcorner ? (-c->bw) : (c->h + c->bw -1));
@ -1731,10 +1730,8 @@ resizemouse(const Arg *arg)
ny = vertcorner ? ev.xmotion.y : c->y; ny = vertcorner ? ev.xmotion.y : c->y;
nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1); nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1);
nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1); nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1);
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
resize(c, nx, ny, nw, nh, 1); resize(c, nx, ny, nw, nh, 1);
/* >>>>>>HEAD */
else { else {
selmon->mfact = (double) (ev.xmotion.x_root - selmon->mx) / (double) selmon->ww; selmon->mfact = (double) (ev.xmotion.x_root - selmon->mx) / (double) selmon->ww;
for(i=0; i<LENGTH(tags); ++i) for(i=0; i<LENGTH(tags); ++i)
@ -1744,20 +1741,9 @@ resizemouse(const Arg *arg)
selmon->pertag->mfacts[0] = selmon->mfact; selmon->pertag->mfacts[0] = selmon->mfact;
arrange(selmon); arrange(selmon);
} }
/* ======= */
/* if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww */
/* && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) */
/* { */
/* if (!c->isfloating && selmon->lt[selmon->sellt]->arrange */
/* && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) */
/* togglefloating(NULL); */
/* } */
/* */
/* >>>>>>> corners */
break; break;
} }
} } while (ev.type != ButtonRelease);
while (ev.type != ButtonRelease);
if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) { if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, XWarpPointer(dpy, None, c->win, 0, 0, 0, 0,
@ -1766,8 +1752,10 @@ resizemouse(const Arg *arg)
} else { } else {
XWarpPointer(dpy, None, root, 0, 0, 0, 0, XWarpPointer(dpy, None, root, 0, 0, 0, 0,
selmon->mx + (selmon->ww * selmon->mfact), selmon->mx + (selmon->ww * selmon->mfact),
selmon->my + (selmon->wh / 2)); selmon->my + (selmon->wh / 2)
);
} }
XUngrabPointer(dpy, CurrentTime); XUngrabPointer(dpy, CurrentTime);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {

View File

@ -1,27 +0,0 @@
diff -pu dwm.git/config.def.h dwm.underlinetags/config.def.h
--- dwm.git/config.def.h 2021-02-27 20:04:32.030570909 -0600
+++ dwm.underlinetags/config.def.h 2021-03-16 16:42:26.278703624 -0500
@@ -21,6 +21,11 @@ static const char *colors[][3] = {
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
+static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
+static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
+static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
+
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
diff -pu dwm.git/dwm.c dwm.underlinetags/dwm.c
--- dwm.git/dwm.c 2021-02-27 20:04:32.030570909 -0600
+++ dwm.underlinetags/dwm.c 2021-03-16 16:41:21.468077151 -0500
@@ -719,6 +719,8 @@ drawbar(Monitor *m)
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 (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
+ drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,