implement bar modules and barpadding support. still lots to do
This commit is contained in:
parent
f8e81f1b09
commit
f9c027c421
19
bar.h
Normal file
19
bar.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* Bar rules allow you to configure what is shown where on the bar, as well as
|
||||
* introducing your own bar modules.
|
||||
*
|
||||
* monitor:
|
||||
* -1 show on all monitors
|
||||
* 0 show on monitor 0
|
||||
* 'A' show on active monitor (i.e. focused / selected) (or just -1 for active?)
|
||||
* bar - bar index, 0 is default, 1 is extrabar
|
||||
* alignment - how the module is aligned compared to other modules
|
||||
* widthfunc, drawfunc, clickfunc - providing bar module width, draw and click functions
|
||||
* name - does nothing, intended for visual clue and for logging / debugging
|
||||
*/
|
||||
static const BarRule barrules[] = {
|
||||
/* monitor bar alignment widthfunc drawfunc clickfunc name */
|
||||
{ -1, 0, BAR_ALIGN_RIGHT, width_tags, draw_tags, click_tags, "tags" },
|
||||
{ -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" },
|
||||
{ 'A', 0, BAR_ALIGN_LEFT, width_status, draw_status, click_status, "status" },
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" },
|
||||
};
|
5
bar/items.c
Normal file
5
bar/items.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* Todo: fill this with shit */
|
||||
#include "tags.c"
|
||||
#include "layoutindicator.c"
|
||||
#include "statusbar.c"
|
||||
#include "title.c"
|
5
bar/items.h
Normal file
5
bar/items.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* Todo: fill this with shit */
|
||||
#include "tags.h"
|
||||
#include "layoutindicator.h"
|
||||
#include "statusbar.h"
|
||||
#include "title.h"
|
17
bar/layoutindicator.c
Normal file
17
bar/layoutindicator.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
int
|
||||
width_ltsymbol(Bar *bar, BarWidthArg *a)
|
||||
{
|
||||
return TEXTW(bar->mon->ltsymbol);
|
||||
}
|
||||
|
||||
int
|
||||
draw_ltsymbol(Bar *bar, BarDrawArg *a)
|
||||
{
|
||||
return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, bar->mon->ltsymbol, 0, False);
|
||||
}
|
||||
|
||||
int
|
||||
click_ltsymbol(Bar *bar, Arg *arg, BarClickArg *a)
|
||||
{
|
||||
return ClkLtSymbol;
|
||||
}
|
3
bar/layoutindicator.h
Normal file
3
bar/layoutindicator.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
static int width_ltsymbol(Bar *bar, BarWidthArg *a);
|
||||
static int draw_ltsymbol(Bar *bar, BarDrawArg *a);
|
||||
static int click_ltsymbol(Bar *bar, Arg *arg, BarClickArg *a);
|
19
bar/statusbar.c
Normal file
19
bar/statusbar.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
int
|
||||
width_status(Bar *bar, BarWidthArg *a)
|
||||
{
|
||||
return TEXTW(stext);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
draw_status(Bar *bar, BarDrawArg *a)
|
||||
{
|
||||
return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, stext, 0, True);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
click_status(Bar *bar, Arg *arg, BarClickArg *a)
|
||||
{
|
||||
return ClkStatusText;
|
||||
}
|
3
bar/statusbar.h
Normal file
3
bar/statusbar.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
static int width_status(Bar *bar, BarWidthArg *a);
|
||||
static int draw_status(Bar *bar, BarDrawArg *a);
|
||||
static int click_status(Bar *bar, Arg *arg, BarClickArg *a);
|
55
bar/tags.c
Normal file
55
bar/tags.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
int
|
||||
width_tags(Bar *bar, BarWidthArg *a)
|
||||
{
|
||||
int w, i;
|
||||
|
||||
for (w = 0, i = 0; i < LENGTH(tags); i++) {
|
||||
w += TEXTW(tags[i]);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
int
|
||||
draw_tags(Bar *bar, BarDrawArg *a)
|
||||
{
|
||||
int invert;
|
||||
int w, x = a->x;
|
||||
int boxs = drw->font->h / 9;
|
||||
int boxw = drw->font->h / 6 + 2;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
Client *c;
|
||||
Monitor *m = bar->mon;
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
occ |= c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
}
|
||||
|
||||
for (i = 0; i < LENGTH(tags); i++) {
|
||||
invert = urg & 1 << i;
|
||||
w = TEXTW(tags[i]);
|
||||
drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeBar]));
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], invert, False);
|
||||
if (occ & 1 << i)
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i, invert);
|
||||
x += w;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
click_tags(Bar *bar, Arg *arg, BarClickArg *a)
|
||||
{
|
||||
int i = 0, x = lrpad / 2;
|
||||
|
||||
do {
|
||||
x += TEXTW(tags[i]);
|
||||
} while (a->rel_x >= x && ++i < LENGTH(tags));
|
||||
if (i < LENGTH(tags)) {
|
||||
arg->ui = 1 << i;
|
||||
}
|
||||
return ClkTagBar;
|
||||
}
|
3
bar/tags.h
Normal file
3
bar/tags.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
static int width_tags(Bar *bar, BarWidthArg *a);
|
||||
static int draw_tags(Bar *bar, BarDrawArg *a);
|
||||
static int click_tags(Bar *bar, Arg *arg, BarClickArg *a);
|
31
bar/title.c
Normal file
31
bar/title.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
int
|
||||
width_wintitle(Bar *bar, BarWidthArg *a)
|
||||
{
|
||||
return a->max_width;
|
||||
}
|
||||
|
||||
int
|
||||
draw_wintitle(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_wintitle(Bar *bar, Arg *arg, BarClickArg *a)
|
||||
{
|
||||
return ClkWinTitle;
|
||||
}
|
3
bar/title.h
Normal file
3
bar/title.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
static int width_wintitle(Bar *bar, BarWidthArg *a);
|
||||
static int draw_wintitle(Bar *bar, BarDrawArg *a);
|
||||
static int click_wintitle(Bar *bar, Arg *arg, BarClickArg *a);
|
2
host.mk
2
host.mk
|
@ -16,7 +16,7 @@ PAGEDIR = "/home/anon/Projects/speediegq/projects"
|
|||
FREETYPELIBS = -lfontconfig -lXft
|
||||
FREETYPEINC = /usr/include/freetype2
|
||||
EXCFLAGS = -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-array-bounds
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Ofast -march=native ${INCS} ${CPPFLAGS} ${EXCFLAGS}
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Ofast -march=native ${INCS} ${CPPFLAGS} #${EXCFLAGS}
|
||||
LDFLAGS = ${LIBS} -g
|
||||
|
||||
# OpenBSD support
|
||||
|
|
11
keybinds.h
11
keybinds.h
|
@ -35,7 +35,6 @@
|
|||
|
||||
/* Tag related keybinds */
|
||||
#define TAGKEYS(CHAIN,KEY,TAG) { MODIFIER1, CHAIN, KEY, view, {.ui = 1 << TAG } }, \
|
||||
{ MODIFIER1|SHIFT, CHAIN, KEY, previewtag, {.ui = TAG} }, \
|
||||
{ MODIFIER1|CONTROL, CHAIN, KEY, toggleview, {.ui = 1 << TAG } }, \
|
||||
{ MODIFIER1|SHIFT|CONTROL, CHAIN, KEY, tag, {.ui = 1 << TAG } },
|
||||
|
||||
|
@ -194,6 +193,7 @@ static Key keys[] = {
|
|||
{ MODIFIER1, XK_p, XK_r, resetbarpadding, {0} },
|
||||
|
||||
/* Chained toggle keybinds */
|
||||
/*
|
||||
{ MODIFIER1, XK_t, XK_t, togglebartags, {0} },
|
||||
{ MODIFIER1, XK_t, XK_w, togglebartitle, {0} },
|
||||
{ MODIFIER1, XK_t, XK_u, togglebarunseltitle, {0} },
|
||||
|
@ -201,17 +201,20 @@ static Key keys[] = {
|
|||
{ MODIFIER1, XK_t, XK_y, togglebaremptytags, {0} },
|
||||
{ MODIFIER1, XK_t, XK_l, togglebarlt, {0} },
|
||||
{ MODIFIER1, XK_t, XK_i, togglebaricon, {0} },
|
||||
*/
|
||||
{ MODIFIER1, XK_t, XK_o, toggleopacity, {0} },
|
||||
{ MODIFIER1, XK_t, XK_b, togglebarpos, {0} },
|
||||
{ MODIFIER1, XK_t, XK_r, resetbar, {0} },
|
||||
//{ MODIFIER1, XK_t, XK_b, togglebarpos, {0} },
|
||||
//{ MODIFIER1, XK_t, XK_r, resetbar, {0} },
|
||||
|
||||
/* Chained powerline toggle keybinds */
|
||||
/*
|
||||
{ MODIFIER1, XK_apostrophe, XK_w, toggletitlepowerline,{0} },
|
||||
{ MODIFIER1, XK_apostrophe, XK_t, toggletagpowerline, {0} },
|
||||
{ MODIFIER1, XK_apostrophe, XK_a, toggletitleplshape, {0} },
|
||||
{ MODIFIER1, XK_apostrophe, XK_d, toggletagplshape, {0} },
|
||||
{ MODIFIER1, XK_apostrophe, XK_s, toggleplshape, {0} },
|
||||
{ MODIFIER1, XK_apostrophe, XK_r, resetpowerline, {0} },
|
||||
*/
|
||||
|
||||
/* Chained music keybinds */
|
||||
{ MODIFIER1, XK_q, XK_n, spawn, cmd( "cmus-remote --next" ) },
|
||||
|
@ -224,7 +227,7 @@ static Key keys[] = {
|
|||
|
||||
/* Misc */
|
||||
{ MODIFIER1, XK_q, XK_o, killunsel, {0} },
|
||||
{ MODIFIER1, XK_l, XK_p, togglelayoutpos, {0} },
|
||||
//{ MODIFIER1, XK_l, XK_p, togglelayoutpos, {0} },
|
||||
{ MODIFIER1|SHIFT, XK_e, XK_p, spawn, cmd( "speedwm-swal --previous" ) },
|
||||
{ MODIFIER1|SHIFT, XK_e, XK_r, spawn, cmd( "speedwm-swal --randomize" ) },
|
||||
{ MODIFIER1|SHIFT, XK_e, XK_a, spawn, cmd( "speedwm-virtualkeyboard" ) },
|
||||
|
|
4
signal.h
4
signal.h
|
@ -25,7 +25,9 @@ static Signal signals[] = {
|
|||
{ 18, setmfact, {.f = +0.05} },
|
||||
{ 19, setmfact, {.f = -0.05} },
|
||||
{ 20, togglesticky, {0} },
|
||||
/*
|
||||
{ 21, togglebar, {0} },
|
||||
*/
|
||||
{ 22, togglefullscr, {0} },
|
||||
{ 23, togglefloating, {0} },
|
||||
{ 24, zoom, {0} },
|
||||
|
@ -76,6 +78,7 @@ static Signal signals[] = {
|
|||
#endif
|
||||
{ 66, viewtoleft_vacant, {0} },
|
||||
{ 67, viewtoright_vacant, {0} },
|
||||
/*
|
||||
{ 68, togglebartags, {0} },
|
||||
{ 69, togglebaremptytags, {0} },
|
||||
{ 70, toggletagpowerline, {0} },
|
||||
|
@ -95,6 +98,7 @@ static Signal signals[] = {
|
|||
{ 84, togglebarpos, {0} },
|
||||
{ 85, togglelayoutpos, {0} },
|
||||
{ 86, resetbar, {0} },
|
||||
*/
|
||||
{ 87, setbarheight, {.i = +1 } },
|
||||
{ 88, setbarheight, {.i = -1 } },
|
||||
{ 89, resetbarheight, {0} },
|
||||
|
|
8
toggle.h
8
toggle.h
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/* IPC */
|
||||
#define USEIPC 1 /* Whether or not to include IPC.
|
||||
#define USEIPC 0 /* Whether or not to include IPC.
|
||||
NOTE: If you set this to 1, set USEIPC to true in toggle.mk and comment the YAJLLIBS and YAJLINC lines in config.mk.
|
||||
Not compatible with BSDs so for those, set this to 0. */
|
||||
|
||||
|
@ -19,7 +19,7 @@ Not compatible with BSDs so for those, set this to 0. */
|
|||
|
||||
/* Miscellanious */
|
||||
#define USESWITCHER 1 /* Whether or not to include the switcher */
|
||||
#define USESYSTRAY 1 /* Whether or not to include the systray */
|
||||
#define USESYSTRAY 0 /* Whether or not to include the systray */
|
||||
#define USEROUNDCORNERS 1 /* Whether or not to include rounded corners */
|
||||
#define USEMEDIA 1 /* Whether or not to include media keys */
|
||||
#define USEMOUSE 1 /* Whether or not to include mouse binds */
|
||||
|
@ -31,5 +31,5 @@ Not compatible with BSDs so for those, set this to 0. */
|
|||
* If you wish to disable them though, set them to 0.
|
||||
*/
|
||||
#define USEIMLIB2 1 /* Whether or not to include imlib2. Required by USEWINICON and USETAGPREVIEW. */
|
||||
#define USEWINICON 1 /* Whether or not to include window icons. Requires imlib to be enabled in toggle.mk and it must be installed. */
|
||||
#define USETAGPREVIEW 1 /* Whether or not to include tag previews. Requires imlib to be enabled in toggle.mk and it must be installed. */
|
||||
#define USEWINICON 0 /* Whether or not to include window icons. Requires imlib to be enabled in toggle.mk and it must be installed. */
|
||||
#define USETAGPREVIEW 0 /* Whether or not to include tag previews. Requires imlib to be enabled in toggle.mk and it must be installed. */
|
||||
|
|
Loading…
Reference in a new issue