implement unfinished powerline statusbar
This commit is contained in:
parent
0752076e88
commit
a7171f58dd
3
bar.h
3
bar.h
|
@ -17,7 +17,8 @@ static const BarRule barrules[] = {
|
|||
{ -1, 0, bar_align_left, width_tags_pwl, draw_tags_pwl, click_tags_pwl, "powerline tags" },
|
||||
{ 'A', 0, bar_align_right, width_systray, draw_systray, click_systray, "systray" },
|
||||
//{ 'A', 0, bar_align_right, width_status_basic, draw_status_basic, click_status_basic, "basic status" },
|
||||
{ 'A', 0, bar_align_right, width_status, draw_status, click_status, "clickable status" },
|
||||
//{ 'A', 0, bar_align_right, width_status, draw_status, click_status, "clickable and colored status" },
|
||||
{ 'A', 0, bar_align_right, width_status_pwl, draw_status_pwl, click_status_pwl, "powerline 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" },
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "layoutindicator.c" /* Include layout indicator */
|
||||
#include "statusbar.c" /* Include status bar with status2d and clickstatus */
|
||||
#include "statusbar-basic.c" /* Include basic status bar */
|
||||
#include "statusbar-powerline.c" /* Include powerline status bar */
|
||||
#include "title-basic.c" /* Include basic title */
|
||||
#include "title.c" /* Include title */
|
||||
#if USESYSTRAY
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "layoutindicator.h"
|
||||
#include "statusbar.h"
|
||||
#include "statusbar-basic.h"
|
||||
#include "statusbar-powerline.h"
|
||||
#include "title-basic.h"
|
||||
#include "title.h"
|
||||
#if USESYSTRAY
|
||||
|
|
90
bar/statusbar-powerline.c
Normal file
90
bar/statusbar-powerline.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
static Clr **powerlinescheme;
|
||||
|
||||
int
|
||||
width_status_pwl(Bar *bar, BarWidthArg *a)
|
||||
{
|
||||
return widthpowerlinestatus(rawstext);
|
||||
}
|
||||
|
||||
int
|
||||
draw_status_pwl(Bar *bar, BarDrawArg *a)
|
||||
{
|
||||
return drawpowerlinestatus(a->x + a->w, rawstext);
|
||||
}
|
||||
|
||||
int
|
||||
click_status_pwl(Bar *bar, Arg *arg, BarClickArg *a)
|
||||
{
|
||||
return ClkStatusText;
|
||||
}
|
||||
|
||||
int
|
||||
widthpowerlinestatus(char *stext)
|
||||
{
|
||||
char status[512];
|
||||
int w = 0, i, n = strlen(stext);
|
||||
int plw = drw->font->h / 2 + 1;
|
||||
char *bs, bp = '|';
|
||||
strcpy(status, stext);
|
||||
|
||||
for (i = n, bs = &status[n-1]; i >= 0; i--, bs--) {
|
||||
if (*bs == '<' || *bs == '/' || *bs == '\\' || *bs == '>' || *bs == '|') { /* block start */
|
||||
if (bp != '|')
|
||||
w += plw;
|
||||
w += TEXTW(bs+2);
|
||||
bp = *bs;
|
||||
*bs = 0;
|
||||
}
|
||||
}
|
||||
if (bp != '|')
|
||||
w += plw * 2;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
int
|
||||
drawpowerlinestatus(int xpos, char *stext)
|
||||
{
|
||||
char status[512];
|
||||
int i, n = strlen(stext), cn = 0;
|
||||
int x = xpos, w = 0;
|
||||
int plw = drw->font->h / 2 + 1;
|
||||
char *bs, bp = '|';
|
||||
Clr *prevscheme = scheme[SchemeBar], *nxtscheme;
|
||||
strcpy(status, stext);
|
||||
|
||||
for (i = n, bs = &status[n-1]; i >= 0; i--, bs--) {
|
||||
if (*bs == '<' || *bs == '/' || *bs == '\\' || *bs == '>' || *bs == '|') { /* block start */
|
||||
cn = ((int) *(bs+1)) + 1;
|
||||
|
||||
if (cn < LENGTH(powerlinecolors)) {
|
||||
drw_settrans(drw, prevscheme, (nxtscheme = powerlinescheme[cn]));
|
||||
} else {
|
||||
drw_settrans(drw, prevscheme, (nxtscheme = powerlinescheme[0]));
|
||||
}
|
||||
|
||||
if (bp != '|') {
|
||||
drw_arrow(drw, x - plw, 0, plw, bh, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1);
|
||||
|
||||
x -= plw;
|
||||
}
|
||||
|
||||
drw_setscheme(drw, nxtscheme);
|
||||
w = TEXTW(bs+2);
|
||||
drw_text(drw, x - w, 0, w, bh, lrpad / 2, bs+2, 0, False);
|
||||
x -= w;
|
||||
|
||||
bp = *bs;
|
||||
*bs = 0;
|
||||
prevscheme = nxtscheme;
|
||||
}
|
||||
}
|
||||
if (bp != '|') {
|
||||
drw_settrans(drw, prevscheme, scheme[SchemeStatus]);
|
||||
drw_arrow(drw, x - plw, 0, plw, bh, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1);
|
||||
drw_rect(drw, x - 2 * plw, 0, plw, bh, 1, 1);
|
||||
x -= plw * 2;
|
||||
}
|
||||
|
||||
return xpos - x;
|
||||
}
|
5
bar/statusbar-powerline.h
Normal file
5
bar/statusbar-powerline.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
static int width_status_pwl(Bar *bar, BarWidthArg *a);
|
||||
static int draw_status_pwl(Bar *bar, BarDrawArg *a);
|
||||
static int click_status_pwl(Bar *bar, Arg *arg, BarClickArg *a);
|
||||
static int drawpowerlinestatus(int x, char *stext);
|
||||
static int widthpowerlinestatus(char *stext);
|
46
colors.h
46
colors.h
|
@ -24,23 +24,19 @@ static char *colors[][3] = {
|
|||
|
||||
/* Colors for the status if powerline status is used */
|
||||
static char *powerlinecolors[][3] = {
|
||||
[SchemePowerline1] = { col_textsel, col_status0, NULL },
|
||||
[SchemePowerline2] = { col_textnorm, col_status1, NULL },
|
||||
[SchemePowerline3] = { col_textnorm, col_status2, NULL },
|
||||
[SchemePowerline4] = { col_textnorm, col_status3, NULL },
|
||||
[SchemePowerline5] = { col_textnorm, col_status4, NULL },
|
||||
[SchemePowerline6] = { col_textnorm, col_status5, NULL },
|
||||
[SchemePowerline7] = { col_textnorm, col_status6, NULL },
|
||||
[SchemePowerline8] = { col_textnorm, col_status7, NULL },
|
||||
[SchemePowerline9] = { col_textnorm, col_status8, NULL },
|
||||
[SchemePowerline10] = { col_textnorm, col_status9, NULL },
|
||||
[SchemePowerline11] = { col_textnorm, col_status10, NULL },
|
||||
[SchemePowerline12] = { col_textnorm, col_status11, NULL },
|
||||
[SchemePowerline13] = { col_textnorm, col_status12, NULL },
|
||||
[SchemePowerline14] = { col_textnorm, col_status13, NULL },
|
||||
[SchemePowerline15] = { col_textnorm, col_status14, NULL },
|
||||
[SchemePowerline16] = { col_textnorm, col_status15, NULL },
|
||||
/* text powerline color unused */
|
||||
[SchemeBar] = { col_powerline0_text, col_powerline0, NULL },
|
||||
[SchemeTagsNorm] = { col_powerline1_text, col_powerline1, NULL },
|
||||
[SchemeTagsSel] = { col_powerline2_text, col_powerline2, NULL },
|
||||
[SchemeTagsUrg] = { col_powerline3_text, col_powerline3, NULL },
|
||||
[SchemeBorderNorm] = { col_powerline4_text, col_powerline4, NULL },
|
||||
[SchemeBorderSel] = { col_powerline5_text, col_powerline5, NULL },
|
||||
[SchemeBorderUrg] = { col_powerline6_text, col_powerline6, NULL },
|
||||
[SchemeStatus] = { col_powerline7_text, col_powerline7, NULL },
|
||||
[SchemeTitleNorm] = { col_powerline8_text, col_powerline8, NULL },
|
||||
[SchemeTitleSel] = { col_powerline9_text, col_powerline9, NULL },
|
||||
[SchemeTitleHidden] = { col_powerline10_text, col_powerline10, NULL },
|
||||
[SchemeLayout] = { col_powerline11_text, col_powerline11, NULL },
|
||||
[SchemeSystray] = { col_powerline12_text, col_powerline12, NULL },
|
||||
};
|
||||
|
||||
/* Colors for the status bar (.Xresources) */
|
||||
|
@ -79,22 +75,6 @@ static unsigned int alphas[][3] = {
|
|||
[SchemeTagsSel] = { tagselopacity, tagselopacity, tagnormopacity },
|
||||
[SchemeTagsUrg] = { tagselopacity, tagselopacity, tagnormopacity },
|
||||
[SchemeSystray] = { opaque, systrayopacity, systrayopacity },
|
||||
[SchemePowerline1] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline2] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline3] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline4] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline5] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline6] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline7] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline8] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline9] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline10] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline11] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline12] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline13] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline14] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline15] = { opaque, statusopacity, statusopacity },
|
||||
[SchemePowerline16] = { opaque, statusopacity, statusopacity },
|
||||
};
|
||||
|
||||
/* Colors to use for tags */
|
||||
|
|
|
@ -72,6 +72,38 @@ speedwm.col.status12: #afc9ac
|
|||
speedwm.col.status13: #eae1cb
|
||||
speedwm.col.status14: #6d5e8e
|
||||
speedwm.col.status15: #ffffff
|
||||
speedwm.col.powerline0: #131210
|
||||
speedwm.col.powerline1: #bf616a
|
||||
speedwm.col.powerline2: #A16F9D
|
||||
speedwm.col.powerline3: #68ABAA
|
||||
speedwm.col.powerline4: #A89F93
|
||||
speedwm.col.powerline5: #D3A99B
|
||||
speedwm.col.powerline6: #AFC9AC
|
||||
speedwm.col.powerline7: #eae1cb
|
||||
speedwm.col.powerline8: #a39d8e
|
||||
speedwm.col.powerline9: #6D5E8E
|
||||
speedwm.col.powerline10: #a16f9d
|
||||
speedwm.col.powerline11: #d3a99b
|
||||
speedwm.col.powerline12: #afc9ac
|
||||
speedwm.col.powerline13: #eae1cb
|
||||
speedwm.col.powerline14: #6d5e8e
|
||||
speedwm.col.powerline15: #ffffff
|
||||
speedwm.col.powerline0_text: #eeeeee
|
||||
speedwm.col.powerline1_text: #131210
|
||||
speedwm.col.powerline2_text: #131210
|
||||
speedwm.col.powerline3_text: #131210
|
||||
speedwm.col.powerline4_text: #131210
|
||||
speedwm.col.powerline5_text: #131210
|
||||
speedwm.col.powerline6_text: #131210
|
||||
speedwm.col.powerline7_text: #131210
|
||||
speedwm.col.powerline8_text: #131210
|
||||
speedwm.col.powerline9_text: #131210
|
||||
speedwm.col.powerline10_text: #131210
|
||||
speedwm.col.powerline11_text: #131210
|
||||
speedwm.col.powerline12_text: #131210
|
||||
speedwm.col.powerline13_text: #131210
|
||||
speedwm.col.powerline14_text: #131210
|
||||
speedwm.col.powerline15_text: #131210
|
||||
speedwm.col.systray: #222222
|
||||
speedwm.col.tag1: #99b3ff
|
||||
speedwm.col.tag1.text: #eeeeee
|
||||
|
|
34
options.h
34
options.h
|
@ -213,6 +213,40 @@ static char col_status13[] = "#eae1cb"; /* Status color 13 */
|
|||
static char col_status14[] = "#6D5E8E"; /* Status color 14 */
|
||||
static char col_status15[] = "#ffffff"; /* Status color 15 */
|
||||
|
||||
/* Powerline colors */
|
||||
static char col_powerline0[] = "#131210"; /* Powerline color 0 */
|
||||
static char col_powerline1[] = "#bf616a"; /* Powerline color 1 */
|
||||
static char col_powerline2[] = "#A16F9D"; /* Powerline color 2 */
|
||||
static char col_powerline3[] = "#68ABAA"; /* Powerline color 3 */
|
||||
static char col_powerline4[] = "#A89F93"; /* Powerline color 4 */
|
||||
static char col_powerline5[] = "#D3A99B"; /* Powerline color 5 */
|
||||
static char col_powerline6[] = "#AFC9AC"; /* Powerline color 6 */
|
||||
static char col_powerline7[] = "#eae1cb"; /* Powerline color 7 */
|
||||
static char col_powerline8[] = "#a39d8e"; /* Powerline color 8 */
|
||||
static char col_powerline9[] = "#6D5E8E"; /* Powerline color 9 */
|
||||
static char col_powerline10[] = "#A16F9D"; /* Powerline color 10 */
|
||||
static char col_powerline11[] = "#D3A99B"; /* Powerline color 11 */
|
||||
static char col_powerline12[] = "#AFC9AC"; /* Powerline color 12 */
|
||||
static char col_powerline13[] = "#eae1cb"; /* Powerline color 13 */
|
||||
static char col_powerline14[] = "#6D5E8E"; /* Powerline color 14 */
|
||||
static char col_powerline15[] = "#ffffff"; /* Powerline color 15 */
|
||||
static char col_powerline0_text[] = "#eeeeee"; /* Powerline text color 0 */
|
||||
static char col_powerline1_text[] = "#131210"; /* Powerline text color 1 */
|
||||
static char col_powerline2_text[] = "#131210"; /* Powerline text color 2 */
|
||||
static char col_powerline3_text[] = "#131210"; /* Powerline text color 3 */
|
||||
static char col_powerline4_text[] = "#131210"; /* Powerline text color 4 */
|
||||
static char col_powerline5_text[] = "#131210"; /* Powerline text color 5 */
|
||||
static char col_powerline6_text[] = "#131210"; /* Powerline text color 6 */
|
||||
static char col_powerline7_text[] = "#131210"; /* Powerline text color 7 */
|
||||
static char col_powerline8_text[] = "#131210"; /* Powerline text color 8 */
|
||||
static char col_powerline9_text[] = "#131210"; /* Powerline text color 9 */
|
||||
static char col_powerline10_text[] = "#131210"; /* Powerline text color 10 */
|
||||
static char col_powerline11_text[] = "#131210"; /* Powerline text color 11 */
|
||||
static char col_powerline12_text[] = "#131210"; /* Powerline text color 12 */
|
||||
static char col_powerline13_text[] = "#131210"; /* Powerline text color 13 */
|
||||
static char col_powerline14_text[] = "#131210"; /* Powerline text color 14 */
|
||||
static char col_powerline15_text[] = "#131210"; /* Powerline text color 15 */
|
||||
|
||||
/* Color options
|
||||
*
|
||||
* Title
|
||||
|
|
48
xresources.h
48
xresources.h
|
@ -54,6 +54,22 @@ ResourcePref resources[] = {
|
|||
{ "col.status13", STRING, &col_status13 },
|
||||
{ "col.status14", STRING, &col_status14 },
|
||||
{ "col.status15", STRING, &col_status15 },
|
||||
{ "col.powerline0_text", STRING, &col_powerline0_text },
|
||||
{ "col.powerline1_text", STRING, &col_powerline1_text },
|
||||
{ "col.powerline2_text", STRING, &col_powerline2_text },
|
||||
{ "col.powerline3_text", STRING, &col_powerline3_text },
|
||||
{ "col.powerline4_text", STRING, &col_powerline4_text },
|
||||
{ "col.powerline5_text", STRING, &col_powerline5_text },
|
||||
{ "col.powerline6_text", STRING, &col_powerline6_text },
|
||||
{ "col.powerline7_text", STRING, &col_powerline7_text },
|
||||
{ "col.powerline8_text", STRING, &col_powerline8_text },
|
||||
{ "col.powerline9_text", STRING, &col_powerline9_text },
|
||||
{ "col.powerline10_text", STRING, &col_powerline10_text },
|
||||
{ "col.powerline11_text", STRING, &col_powerline11_text },
|
||||
{ "col.powerline12_text", STRING, &col_powerline12_text },
|
||||
{ "col.powerline13_text", STRING, &col_powerline13_text },
|
||||
{ "col.powerline14_text", STRING, &col_powerline14_text },
|
||||
{ "col.powerline15_text", STRING, &col_powerline15_text },
|
||||
{ "col.systray", STRING, &col_systray },
|
||||
{ "run.shell", STRING, &shell },
|
||||
{ "status.defaultstatus", STRING, &defaultstatus },
|
||||
|
@ -203,5 +219,37 @@ ResourcePref resources[] = {
|
|||
{ "color13", STRING, &col_status13 },
|
||||
{ "color14", STRING, &col_status14 },
|
||||
{ "color15", STRING, &col_status15 },
|
||||
{ "color0", STRING, &col_powerline0 },
|
||||
{ "color1", STRING, &col_powerline1 },
|
||||
{ "color2", STRING, &col_powerline2 },
|
||||
{ "color3", STRING, &col_powerline3 },
|
||||
{ "color4", STRING, &col_powerline4 },
|
||||
{ "color5", STRING, &col_powerline5 },
|
||||
{ "color6", STRING, &col_powerline6 },
|
||||
{ "color7", STRING, &col_powerline7 },
|
||||
{ "color8", STRING, &col_powerline8 },
|
||||
{ "color9", STRING, &col_powerline9 },
|
||||
{ "color10", STRING, &col_powerline10 },
|
||||
{ "color11", STRING, &col_powerline11 },
|
||||
{ "color12", STRING, &col_powerline12 },
|
||||
{ "color13", STRING, &col_powerline13 },
|
||||
{ "color14", STRING, &col_powerline14 },
|
||||
{ "color15", STRING, &col_powerline15 },
|
||||
{ "color4", STRING, &col_powerline0_text },
|
||||
{ "color0", STRING, &col_powerline1_text },
|
||||
{ "color0", STRING, &col_powerline2_text },
|
||||
{ "color0", STRING, &col_powerline3_text },
|
||||
{ "color0", STRING, &col_powerline4_text },
|
||||
{ "color0", STRING, &col_powerline5_text },
|
||||
{ "color0", STRING, &col_powerline6_text },
|
||||
{ "color0", STRING, &col_powerline7_text },
|
||||
{ "color0", STRING, &col_powerline8_text },
|
||||
{ "color0", STRING, &col_powerline9_text },
|
||||
{ "color10", STRING, &col_powerline10_text },
|
||||
{ "color11", STRING, &col_powerline11_text },
|
||||
{ "color12", STRING, &col_powerline12_text },
|
||||
{ "color13", STRING, &col_powerline13_text },
|
||||
{ "color14", STRING, &col_powerline14_text },
|
||||
{ "color15", STRING, &col_powerline15_text },
|
||||
/* value in .Xresources type value in speedwm */
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue