sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 04716e1c7a529d184d302693c0a72f695f5e560a
parent 09ff1ef0702ac815fcbe7f780e57a512f1ec8195
Author: Timmy Keller <applesrcol8796@gmail.com>
Date:   Mon, 15 Mar 2021 21:27:18 -0500

[dwm][patch][revision] revises stickyindicator patch and removes images

Diffstat:
Ddwm.suckless.org/patches/stickyindicator/bmicon.jpg | 0
Mdwm.suckless.org/patches/stickyindicator/dwm-stickyindicator-6.2.diff | 17++++++++---------
Mdwm.suckless.org/patches/stickyindicator/dwm-stickyindicator-fancybarfix-6.2.diff | 19+++++++++----------
Mdwm.suckless.org/patches/stickyindicator/index.md | 39+++++++++++----------------------------
Ddwm.suckless.org/patches/stickyindicator/octicon.jpg | 0
Ddwm.suckless.org/patches/stickyindicator/sicon.jpg | 0
6 files changed, 28 insertions(+), 47 deletions(-)

diff --git a/dwm.suckless.org/patches/stickyindicator/bmicon.jpg b/dwm.suckless.org/patches/stickyindicator/bmicon.jpg Binary files differ. diff --git a/dwm.suckless.org/patches/stickyindicator/dwm-stickyindicator-6.2.diff b/dwm.suckless.org/patches/stickyindicator/dwm-stickyindicator-6.2.diff @@ -1,19 +1,18 @@ diff -pu dwm.stickypatch/config.def.h dwm.stickyindicator/config.def.h --- dwm.stickypatch/config.def.h 2021-02-28 23:51:25.118904642 -0600 -+++ dwm.stickyindicator/config.def.h 2021-03-01 19:39:53.190077064 -0600 -@@ -17,6 +17,9 @@ static const char *colors[][3] = { ++++ dwm.stickyindicator/config.def.h 2021-03-15 20:19:53.533323727 -0500 +@@ -17,6 +17,8 @@ static const char *colors[][3] = { [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, }; -+static const XPoint stickyicon[] = { {0,0}, {4,0}, {4,4}, {2,3}, {0,4}, {0,0} }; /* represents the icon as an array of vertices like in grade school math */ -+static const XPoint stickyiconbb = {4,4}; /* defines the bottom right corner of the bounding box of the polygon (origin is always 0,0) */ -+#define STICKYICONSH boxw + (boxw * 6 / 7) /* defines the height of the final, scaled polygon as it will be drawn. boxw is equal to the width of the shape */ ++static const XPoint stickyicon[] = { {0,0}, {4,0}, {4,8}, {2,6}, {0,8}, {0,0} }; /* represents the icon as an array of vertices */ ++static const XPoint stickyiconbb = {4,8}; /* defines the bottom right corner of the polygon's bounding box (speeds up scaling) */ /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; diff -pu dwm.stickypatch/drw.c dwm.stickyindicator/drw.c --- dwm.stickypatch/drw.c 2021-02-28 23:51:06.992237482 -0600 -+++ dwm.stickyindicator/drw.c 2021-03-01 20:35:20.470241455 -0600 ++++ dwm.stickyindicator/drw.c 2021-03-15 20:19:19.499990633 -0500 @@ -248,6 +248,26 @@ drw_rect(Drw *drw, int x, int y, unsigne XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1); } @@ -33,7 +32,7 @@ diff -pu dwm.stickypatch/drw.c dwm.stickyindicator/drw.c + for (int v = 0; v < npoints; v++) + scaledpoints[v] = (XPoint){ .x = points[v].x * sw / ow + x, .y = points[v].y * sh / oh + y }; + if (filled) -+ XFillPolygon(drw->dpy, drw->drawable, drw->gc, scaledpoints, npoints, shape, CoordModeOrigin); ++ XFillPolygon(drw->dpy, drw->drawable, drw->gc, scaledpoints, npoints, shape, CoordModeOrigin); /* Change shape to 'Convex' or 'Complex' in dwm.c if the shape is not 'Nonconvex' */ + else + XDrawLines(drw->dpy, drw->drawable, drw->gc, scaledpoints, npoints, CoordModeOrigin); +} @@ -54,13 +53,13 @@ diff -pu dwm.stickypatch/drw.h dwm.stickyindicator/drw.h /* Map functions */ diff -pu dwm.stickypatch/dwm.c dwm.stickyindicator/dwm.c --- dwm.stickypatch/dwm.c 2021-02-28 23:51:25.118904642 -0600 -+++ dwm.stickyindicator/dwm.c 2021-03-01 20:30:34.940227293 -0600 ++++ dwm.stickyindicator/dwm.c 2021-03-15 20:12:32.063326766 -0500 @@ -736,6 +736,8 @@ drawbar(Monitor *m) 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); + if (m->sel->issticky) -+ drw_polygon(drw, x + boxs, m->sel->isfloating ? boxs * 2 + boxw : boxs, stickyiconbb.x, stickyiconbb.y, boxw, STICKYICONSH, stickyicon, LENGTH(stickyicon), Nonconvex, m->sel->tags & m->tagset[m->seltags]); ++ drw_polygon(drw, x + boxs, m->sel->isfloating ? boxs * 2 + boxw : boxs, stickyiconbb.x, stickyiconbb.y, boxw, boxw * stickyiconbb.y / stickyiconbb.x, stickyicon, LENGTH(stickyicon), Nonconvex, m->sel->tags & m->tagset[m->seltags]); } else { drw_setscheme(drw, scheme[SchemeNorm]); drw_rect(drw, x, 0, w, bh, 1, 1); diff --git a/dwm.suckless.org/patches/stickyindicator/dwm-stickyindicator-fancybarfix-6.2.diff b/dwm.suckless.org/patches/stickyindicator/dwm-stickyindicator-fancybarfix-6.2.diff @@ -1,19 +1,18 @@ diff -pu dwm.fancybarpatch/config.def.h dwm.stickyindicator-fancybarfix/config.def.h --- dwm.fancybarpatch/config.def.h 2021-03-01 20:52:06.470291172 -0600 -+++ dwm.stickyindicator-fancybarfix/config.def.h 2021-03-01 20:51:02.120287996 -0600 -@@ -17,6 +17,9 @@ static const char *colors[][3] = { ++++ dwm.stickyindicator-fancybarfix/config.def.h 2021-03-15 21:12:57.823301478 -0500 +@@ -17,6 +17,8 @@ static const char *colors[][3] = { [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, }; -+static const XPoint stickyicon[] = { {0,0}, {4,0}, {4,4}, {2,3}, {0,4}, {0,0} }; /* represents the icon as an array of vertices like in grade school math */ -+static const XPoint stickyiconbb = {4,4}; /* defines the bottom right corner of the bounding box of the polygon (origin is always 0,0) */ -+#define STICKYICONSH boxw + (boxw * 6 / 7) /* defines the height of the final, scaled polygon as it will be drawn. boxw is equal to the width of the shape */ ++static const XPoint stickyicon[] = { {0,0}, {4,0}, {4,8}, {2,6}, {0,8}, {0,0} }; /* represents the icon as an array of vertices */ ++static const XPoint stickyiconbb = {4,8}; /* defines the bottom right corner of the polygon's bounding box (speeds up scaling) */ /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; diff -pu dwm.fancybarpatch/drw.c dwm.stickyindicator-fancybarfix/drw.c --- dwm.fancybarpatch/drw.c 2021-03-01 20:39:31.890253915 -0600 -+++ dwm.stickyindicator-fancybarfix/drw.c 2021-03-01 20:45:59.293606357 -0600 ++++ dwm.stickyindicator-fancybarfix/drw.c 2021-03-15 21:13:39.643301192 -0500 @@ -248,6 +248,26 @@ drw_rect(Drw *drw, int x, int y, unsigne XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1); } @@ -33,7 +32,7 @@ diff -pu dwm.fancybarpatch/drw.c dwm.stickyindicator-fancybarfix/drw.c + for (int v = 0; v < npoints; v++) + scaledpoints[v] = (XPoint){ .x = points[v].x * sw / ow + x, .y = points[v].y * sh / oh + y }; + if (filled) -+ XFillPolygon(drw->dpy, drw->drawable, drw->gc, scaledpoints, npoints, shape, CoordModeOrigin); ++ XFillPolygon(drw->dpy, drw->drawable, drw->gc, scaledpoints, npoints, shape, CoordModeOrigin); /* Change shape to 'Convex' or 'Complex' in dwm.c if the shape is not 'Nonconvex' */ + else + XDrawLines(drw->dpy, drw->drawable, drw->gc, scaledpoints, npoints, CoordModeOrigin); +} @@ -43,7 +42,7 @@ diff -pu dwm.fancybarpatch/drw.c dwm.stickyindicator-fancybarfix/drw.c { diff -pu dwm.fancybarpatch/drw.h dwm.stickyindicator-fancybarfix/drw.h --- dwm.fancybarpatch/drw.h 2021-03-01 20:39:31.890253915 -0600 -+++ dwm.stickyindicator-fancybarfix/drw.h 2021-03-01 20:46:24.320274275 -0600 ++++ dwm.stickyindicator-fancybarfix/drw.h 2021-03-15 21:14:04.169967692 -0500 @@ -51,6 +51,7 @@ void drw_setscheme(Drw *drw, Clr *scm); /* Drawing functions */ @@ -54,13 +53,13 @@ diff -pu dwm.fancybarpatch/drw.h dwm.stickyindicator-fancybarfix/drw.h /* Map functions */ diff -pu dwm.fancybarpatch/dwm.c dwm.stickyindicator-fancybarfix/dwm.c --- dwm.fancybarpatch/dwm.c 2021-03-01 20:52:06.470291172 -0600 -+++ dwm.stickyindicator-fancybarfix/dwm.c 2021-03-01 20:47:17.293610226 -0600 ++++ dwm.stickyindicator-fancybarfix/dwm.c 2021-03-15 21:16:48.056633227 -0500 @@ -760,6 +760,8 @@ drawbar(Monitor *m) drw_text(drw, x, 0, tw, bh, lrpad / 2, c->name, 0); if (c->isfloating) drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0); + if (c->issticky) -+ drw_polygon(drw, x + boxs, c->isfloating ? boxs * 2 + boxw : boxs, stickyiconbb.x, stickyiconbb.y, boxw, STICKYICONSH, stickyicon, LENGTH(stickyicon), Nonconvex, c->tags & c->mon->tagset[c->mon->seltags]); ++ drw_polygon(drw, x + boxs, c->isfloating ? boxs * 2 + boxw : boxs, stickyiconbb.x, stickyiconbb.y, boxw, boxw * stickyiconbb.y / stickyiconbb.x, stickyicon, LENGTH(stickyicon), Nonconvex, c->tags & c->mon->tagset[c->mon->seltags]); x += tw; w -= tw; } diff --git a/dwm.suckless.org/patches/stickyindicator/index.md b/dwm.suckless.org/patches/stickyindicator/index.md @@ -1,40 +1,23 @@ -functionalgaps -========== +stickyindicator +=============== Description ----------- -This is a patch for [sticky](../sticky) users who want an indicator in their bar when a window is sticky. The icon will appear underneath the floating icon, and is highly customizable. The shape is filled in when you are on the sticky window's original tag(s), and appears as an outline otherwise. +This is a patch for [sticky](../sticky) users who want an indicator in their bar to show when a window is sticky. The icon will appear underneath the floating icon. The shape is filled in when you are on the sticky window's original tag(s), and appears as an outline otherwise. -[![Default icon](bmicon.jpg)](bmicon.jpg) -* (All screenshots are shown with [fancybar](../fancybar) and [hidevacanttags](../hidevacanttags) for demonstration purposes) +The indicator icon is drawn using an X11 wrapper to handle drawing scaled polygons. Because of this, the icon is very versitile. It can be changed by editing the vertices stored in the config variable `stickyicon[]`. -This patch draws the indicator icon as a polygon using an added wrapper to handle drawing scaled polygons with X11. Because of this, the little icon is very versitile (although, that doesn't mean you will get good results). In fact, the icon can be changed just by editing the vertices stored in `stickyicon[]` in the config file. Some examples of alternate icons are shown below. - -Default bookmark icon (looks by far the best on high and low-dpi displays) -* `stickyicon[] = { {0,0}, {4,0}, {4,4}, {2,3}, {0,4}, {0,0} }; /* represents the icon as an array of vertices like in grade school math */` -* `stickyiconbb = {4,4}; /* defines the bottom right corner of the bounding box of the polygon (origin is always 0,0) */` -* `#define STICKYICONSH boxw + (boxw * 6 / 7) /* defines the height of the final, scaled polygon as it will be drawn. boxw is equal to the width of the shape */` - -'S' icon (only readable on high-dpi displays) -* `stickyicon[] = { {4,0}, {0,0}, {0,4}, {3,4}, {3,6}, {0,6}, {0,7}, {4,7}, {4,3}, {1,3}, {1,1}, {4,1}, {4,0} };` -* `stickyiconbb = {4,7};` -* `#define STICKYICONSH boxw * 2` - -[![Bad 'S' icon](sicon.jpg)](sicon.jpg) - -Octogon icon -* `static const XPoint stickyicon[] = { {1,0}, {2,0}, {3,1}, {3,2}, {2,3}, {1,3}, {0,2}, {0,1}, {1,0} };` -* `static const XPoint stickyiconbb = {3,3};` -* `#define STICKYICONSH boxw` - -[![Oct-i-con](octicon.jpg)](octicon.jpg) - -Tip: The size of the icon (and thus, its resolution) is controlled by the fontsize used in your config file (same behavior as the floating indicator icon). This patch also works very well on high-dpi displays since they can show the detail of the tiny icon better. Simple icons also tend to look far better than complex ones. +The defaut icon represents a bookmark, akin to this lovely representation made using box drawing characters: + ┌──┐ + │┈┈│ + │╱╲│ Download -------- * [dwm-stickyindicator-6.2.diff](dwm-stickyindicator-6.2.diff) -* [dwm-stickyindicator-fancybarfix-6.2.diff](dwm-stickyindicator-fancybarfix-6.2.diff) (this fix is for fancybar users, since there is a small conflict) +* [dwm-stickyindicator-fancybarfix-6.2.diff](dwm-stickyindicator-fancybarfix-6.2.diff) (version compatable with fancybar) + +Tip: make sure to install this on top of [sticky](../sticky). Author ------ diff --git a/dwm.suckless.org/patches/stickyindicator/octicon.jpg b/dwm.suckless.org/patches/stickyindicator/octicon.jpg Binary files differ. diff --git a/dwm.suckless.org/patches/stickyindicator/sicon.jpg b/dwm.suckless.org/patches/stickyindicator/sicon.jpg Binary files differ.