summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch')
-rw-r--r--patch/include.c5
-rw-r--r--patch/statuscolors.c23
2 files changed, 27 insertions, 1 deletions
diff --git a/patch/include.c b/patch/include.c
index 72a840c..42b35f4 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -110,6 +110,9 @@
#if STACKER_PATCH
#include "stacker.c"
#endif
+#if STATUSCOLORS_PATCH
+#include "statuscolors.c"
+#endif
#if STATUSCMD_PATCH
#include "statuscmd.c"
#endif
@@ -221,4 +224,4 @@
#endif
#if TILE_LAYOUT
#include "tile.c"
-#endif
+#endif \ No newline at end of file
diff --git a/patch/statuscolors.c b/patch/statuscolors.c
new file mode 100644
index 0000000..2f015ad
--- /dev/null
+++ b/patch/statuscolors.c
@@ -0,0 +1,23 @@
+int
+textw_wosc(char *s)
+{
+ char *ts = s;
+ char *tp = s;
+ int sw = 0;
+ char ctmp;
+ while (1) {
+ if ((unsigned int)*ts > LENGTH(colors)) {
+ ts++;
+ continue;
+ }
+ ctmp = *ts;
+ *ts = '\0';
+ sw += drw_fontset_getwidth(drw, tp);
+ *ts = ctmp;
+ if (ctmp == '\0')
+ break;
+ tp = ++ts;
+ }
+
+ return sw;
+} \ No newline at end of file