Compare commits

..

3 Commits

Author SHA1 Message Date
Jakub
6786398753 Merge branch 'corners' 2024-05-17 16:37:34 -04:00
Jakub
e81a63ab1c resize corners patch 2024-05-17 16:13:14 -04:00
Jakub
7424a27ffc underline tages patch 2024-05-17 16:09:32 -04:00
3 changed files with 55 additions and 11 deletions

View File

@ -33,6 +33,11 @@ static const unsigned int alphas[][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

34
dwm.c
View File

@ -888,6 +888,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,
@ -1698,15 +1700,14 @@ resizemouse(const Arg *arg)
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
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 (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui))
return;
horizcorner = nx < c->w / 2;
vertcorner = ny < c->h / 2;
XWarpPointer (dpy, None, c->win, 0, 0, 0, 0,
horizcorner ? (-c->bw) : (c->w + c->bw -1),
vertcorner ? (-c->bw) : (c->h + c->bw -1));
horizcorner ? (-c->bw) : (c->w + c->bw -1),
vertcorner ? (-c->bw) : (c->h + c->bw -1));
} else {
XWarpPointer(dpy, None, root, 0, 0, 0, 0,
selmon->mx + (selmon->ww * selmon->mfact),
@ -1730,8 +1731,10 @@ resizemouse(const Arg *arg)
ny = vertcorner ? ev.xmotion.y : c->y;
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);
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
resize(c, nx, ny, nw, nh, 1);
/* >>>>>>HEAD */
else {
selmon->mfact = (double) (ev.xmotion.x_root - selmon->mx) / (double) selmon->ww;
for(i=0; i<LENGTH(tags); ++i)
@ -1741,21 +1744,30 @@ resizemouse(const Arg *arg)
selmon->pertag->mfacts[0] = selmon->mfact;
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;
}
} while (ev.type != ButtonRelease);
}
while (ev.type != ButtonRelease);
if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0,
horizcorner ? (-c->bw) : (c->w + c->bw - 1),
vertcorner ? (-c->bw) : (c->h + c->bw - 1));
horizcorner ? (-c->bw) : (c->w + c->bw - 1),
vertcorner ? (-c->bw) : (c->h + c->bw - 1));
} else {
XWarpPointer(dpy, None, root, 0, 0, 0, 0,
selmon->mx + (selmon->ww * selmon->mfact),
selmon->my + (selmon->wh / 2)
);
selmon->my + (selmon->wh / 2));
}
XUngrabPointer(dpy, CurrentTime);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {

View File

@ -0,0 +1,27 @@
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,