rename old title, add awesomebar title
This commit is contained in:
parent
2004e5dddf
commit
b9259c32db
7
bar.h
7
bar.h
|
@ -12,9 +12,10 @@
|
||||||
*/
|
*/
|
||||||
static const BarRule barrules[] = {
|
static const BarRule barrules[] = {
|
||||||
/* monitor bar alignment widthfunc drawfunc clickfunc name */
|
/* monitor bar alignment widthfunc drawfunc clickfunc name */
|
||||||
{ -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, "tags" },
|
|
||||||
{ -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" },
|
{ -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" },
|
||||||
//{ 'A', 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, "status" },
|
{ -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, "tags" },
|
||||||
{ 'A', 0, BAR_ALIGN_RIGHT, width_systray, draw_systray, click_systray, "systray" },
|
{ 'A', 0, BAR_ALIGN_RIGHT, width_systray, draw_systray, click_systray, "systray" },
|
||||||
{ -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" },
|
{ 'A', 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, "status" },
|
||||||
|
//{ -1, 0, BAR_ALIGN_NONE, width_title_basic, draw_title_basic, click_title_basic, "basic title" },
|
||||||
|
{ -1, 0, BAR_ALIGN_NONE, width_title, draw_title, click_title, "title" },
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "tags.c"
|
#include "tags.c"
|
||||||
#include "layoutindicator.c"
|
#include "layoutindicator.c"
|
||||||
#include "statusbar.c"
|
#include "statusbar.c"
|
||||||
|
#include "title-basic.c"
|
||||||
#include "title.c"
|
#include "title.c"
|
||||||
#if USESYSTRAY
|
#if USESYSTRAY
|
||||||
#include "systray.c"
|
#include "systray.c"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "tags.h"
|
#include "tags.h"
|
||||||
#include "layoutindicator.h"
|
#include "layoutindicator.h"
|
||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
|
#include "title-basic.h"
|
||||||
#include "title.h"
|
#include "title.h"
|
||||||
#if USESYSTRAY
|
#if USESYSTRAY
|
||||||
#include "systray.h"
|
#include "systray.h"
|
||||||
|
|
31
bar/title-basic.c
Normal file
31
bar/title-basic.c
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
int
|
||||||
|
width_title_basic(Bar *bar, BarWidthArg *a)
|
||||||
|
{
|
||||||
|
return a->max_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
draw_title_basic(Bar *bar, BarDrawArg *a)
|
||||||
|
{
|
||||||
|
int boxs = drw->font->h / 9;
|
||||||
|
int boxw = drw->font->h / 6 + 2;
|
||||||
|
int x = a->x, w = a->w;
|
||||||
|
Monitor *m = bar->mon;
|
||||||
|
|
||||||
|
if (m->sel) {
|
||||||
|
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
|
||||||
|
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False);
|
||||||
|
if (m->sel->isfloating)
|
||||||
|
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
||||||
|
} else {
|
||||||
|
drw_setscheme(drw, scheme[SchemeBar]);
|
||||||
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
|
}
|
||||||
|
return x + w;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
click_title_basic(Bar *bar, Arg *arg, BarClickArg *a)
|
||||||
|
{
|
||||||
|
return ClkWinTitle;
|
||||||
|
}
|
3
bar/title-basic.h
Normal file
3
bar/title-basic.h
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
static int width_title_basic(Bar *bar, BarWidthArg *a);
|
||||||
|
static int draw_title_basic(Bar *bar, BarDrawArg *a);
|
||||||
|
static int click_title_basic(Bar *bar, Arg *arg, BarClickArg *a);
|
69
bar/title.c
69
bar/title.c
|
@ -1,31 +1,68 @@
|
||||||
int
|
int
|
||||||
width_wintitle(Bar *bar, BarWidthArg *a)
|
width_title(Bar *bar, BarWidthArg *a)
|
||||||
{
|
{
|
||||||
return a->max_width;
|
return a->max_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
draw_wintitle(Bar *bar, BarDrawArg *a)
|
draw_title(Bar *bar, BarDrawArg *a)
|
||||||
{
|
{
|
||||||
int boxs = drw->font->h / 9;
|
int n = 0, scm, remainder = 0, tabw, padding;
|
||||||
int boxw = drw->font->h / 6 + 2;
|
unsigned int i;
|
||||||
int x = a->x, w = a->w;
|
int x = a->x, w = a->w;
|
||||||
Monitor *m = bar->mon;
|
|
||||||
|
|
||||||
if (m->sel) {
|
Client *c;
|
||||||
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
|
for (c = bar->mon->clients; c; c = c->next)
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False);
|
if (ISVISIBLE(c))
|
||||||
if (m->sel->isfloating)
|
n++;
|
||||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
|
||||||
} else {
|
if (n > 0) {
|
||||||
drw_setscheme(drw, scheme[SchemeBar]);
|
remainder = w % n;
|
||||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
tabw = w / n;
|
||||||
|
for (i = 0, c = bar->mon->clients; c; c = c->next, i++) {
|
||||||
|
if (!ISVISIBLE(c))
|
||||||
|
continue;
|
||||||
|
if (bar->mon->sel == c)
|
||||||
|
scm = SchemeTitleSel;
|
||||||
|
else if (HIDDEN(c))
|
||||||
|
scm = SchemeTitleHidden;
|
||||||
|
else
|
||||||
|
scm = SchemeTitleNorm;
|
||||||
|
|
||||||
|
padding = lrpad / 2;
|
||||||
|
if (TEXTW(c->name) < tabw && titleposition)
|
||||||
|
padding = (tabw - TEXTW(c->name) + lrpad) / 2;
|
||||||
|
|
||||||
|
drw_setscheme(drw, scheme[scm]);
|
||||||
|
drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, padding, c->name, 0, False);
|
||||||
|
x += tabw + (i < remainder ? 1 : 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return x + w;
|
return a->x + a->w;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
click_wintitle(Bar *bar, Arg *arg, BarClickArg *a)
|
click_title(Bar *bar, Arg *arg, BarClickArg *a)
|
||||||
{
|
{
|
||||||
return ClkWinTitle;
|
int x = 0, n = 0;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for (c = bar->mon->clients; c; c = c->next)
|
||||||
|
if (ISVISIBLE(c))
|
||||||
|
n++;
|
||||||
|
|
||||||
|
c = bar->mon->clients;
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (!c || !ISVISIBLE(c))
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
x += (1.0 / (double)n) * a->rel_w;
|
||||||
|
} while (c && a->rel_x > x && (c = c->next));
|
||||||
|
|
||||||
|
if (c) {
|
||||||
|
arg->v = c;
|
||||||
|
return ClkWinTitle;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
static int width_wintitle(Bar *bar, BarWidthArg *a);
|
static int width_title(Bar *bar, BarWidthArg *a);
|
||||||
static int draw_wintitle(Bar *bar, BarDrawArg *a);
|
static int draw_title(Bar *bar, BarDrawArg *a);
|
||||||
static int click_wintitle(Bar *bar, Arg *arg, BarClickArg *a);
|
static int click_title(Bar *bar, Arg *arg, BarClickArg *a);
|
||||||
|
|
Loading…
Reference in a new issue