summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch')
-rw-r--r--patch/status2d.c13
-rw-r--r--patch/status2d.h2
2 files changed, 9 insertions, 6 deletions
diff --git a/patch/status2d.c b/patch/status2d.c
index 936b21a..99dcacd 100644
--- a/patch/status2d.c
+++ b/patch/status2d.c
@@ -1,5 +1,5 @@
int
-drawstatusbar(Monitor *m, int bh, char* stext, int stw, int stp)
+drawstatusbar(Monitor *m, int bh, char* stext, int stw, int stp, int align)
{
int ret, i, w, x, len;
short isCode = 0;
@@ -49,8 +49,13 @@ drawstatusbar(Monitor *m, int bh, char* stext, int stw, int stp)
isCode = 0;
text = p;
w += 2; /* 1px padding on both sides */
- x = m->ww - w - stw + stp;
- ret = m->ww - w;
+ if (align == 0)
+ x = 0 + stp; // left
+ else if (align == 1)
+ x = m->ww - w - stw + stp; // right
+ else
+ x = m->ww / 2 - w / 2; // center
+ ret = w;
drw_setscheme(drw, scheme[LENGTH(colors)]);
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
@@ -200,7 +205,5 @@ status2dtextlength(char* stext)
#else
w += TEXTW(text) - lrpad;
#endif // PANGO_PATCH
- else
- isCode = 0;
return w;
}
diff --git a/patch/status2d.h b/patch/status2d.h
index 53f6c69..7688807 100644
--- a/patch/status2d.h
+++ b/patch/status2d.h
@@ -1,2 +1,2 @@
-static int drawstatusbar(Monitor *m, int bh, char* text, int stw, int stp);
+static int drawstatusbar(Monitor *m, int bh, char* text, int stw, int stp, int align);
static int status2dtextlength(char* stext); \ No newline at end of file