aboutsummaryrefslogtreecommitdiff
path: root/sei.c
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-01-12 04:22:05 -0800
committerFuwn <[email protected]>2024-01-12 04:22:12 -0800
commit2a1adc106e9d48509dc0ae41651a7d02aeed2cf8 (patch)
tree06a333ee031cdadb1cf2dd2f61366d1e0995f0c6 /sei.c
parentfeat(config.h): use rofi-emoji (diff)
downloadseiwm-2a1adc106e9d48509dc0ae41651a7d02aeed2cf8.tar.xz
seiwm-2a1adc106e9d48509dc0ae41651a7d02aeed2cf8.zip
feat: centretitle patch toggle
Diffstat (limited to 'sei.c')
-rw-r--r--sei.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sei.c b/sei.c
index 34d046c..936711e 100644
--- a/sei.c
+++ b/sei.c
@@ -1115,6 +1115,7 @@ void apply_fribidi(char *str) {
void drawbar(Monitor *m) {
int x, w, tw = 0, stw = 0;
+ int tlpad;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
@@ -1160,12 +1161,22 @@ void drawbar(Monitor *m) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
apply_fribidi(m->sel->name);
- drw_text(drw, x, 0, w - 2 * sp, bh,
- lrpad / 2 + (m->sel->icon ? m->sel->icw + ICONSPACING : 0),
- fribidi_text, 0);
- if (m->sel->icon)
- drw_pic(drw, x + lrpad / 2, (bh - m->sel->ich) / 2, m->sel->icw,
- m->sel->ich, m->sel->icon);
+ if (centretitle) {
+ tlpad = MAX((m->ww - ((int)TEXTW(fribidi_text) - lrpad)) / 2 - x,
+ lrpad / 2 + (m->sel->icon ? m->sel->icw + ICONSPACING : 0));
+ drw_text(drw, x, 0, w - 2 * sp, bh, tlpad, fribidi_text, 0);
+ if (m->sel->icon)
+ drw_pic(
+ drw, x + tlpad - (m->sel->icon ? m->sel->icw + ICONSPACING : 0),
+ (bh - m->sel->ich) / 2, m->sel->icw, m->sel->ich, m->sel->icon);
+ } else {
+ drw_text(drw, x, 0, w - 2 * sp, bh,
+ lrpad / 2 + (m->sel->icon ? m->sel->icw + ICONSPACING : 0),
+ fribidi_text, 0);
+ if (m->sel->icon)
+ drw_pic(drw, x + lrpad / 2, (bh - m->sel->ich) / 2, m->sel->icw,
+ m->sel->ich, m->sel->icon);
+ }
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else {