Add powerline for items
Currently does not work with !lines, and as such it has been disabled for the time being.
This commit is contained in:
parent
3b10355e5a
commit
aa62ca8cdd
|
@ -104,10 +104,12 @@ spmenu.powerlineprompt: 1
|
||||||
spmenu.powerlinecount: 1
|
spmenu.powerlinecount: 1
|
||||||
spmenu.powerlinemode: 1
|
spmenu.powerlinemode: 1
|
||||||
spmenu.powerlinecaps: 1
|
spmenu.powerlinecaps: 1
|
||||||
|
spmenu.powerlineitems: 1
|
||||||
spmenu.promptpwlstyle: 2
|
spmenu.promptpwlstyle: 2
|
||||||
spmenu.matchcountpwlstyle: 2
|
spmenu.matchcountpwlstyle: 2
|
||||||
spmenu.modepwlstyle: 2
|
spmenu.modepwlstyle: 2
|
||||||
spmenu.capspwlstyle: 2
|
spmenu.capspwlstyle: 2
|
||||||
|
spmenu.itempwlstyle: 2
|
||||||
|
|
||||||
!! Misc color
|
!! Misc color
|
||||||
spmenu.globalcolors: 1
|
spmenu.globalcolors: 1
|
||||||
|
|
|
@ -144,10 +144,12 @@ spmenu = {
|
||||||
matchcountstyle = 2; // Match count powerline style (0: <, 1: /, 2: ()
|
matchcountstyle = 2; // Match count powerline style (0: <, 1: /, 2: ()
|
||||||
modestyle = 2; // Mode indicator powerline style (0: <, 1: /, 2: ()
|
modestyle = 2; // Mode indicator powerline style (0: <, 1: /, 2: ()
|
||||||
capsstyle = 2; // Caps lock indicator powerline style (0: <, 1: /, 2: ()
|
capsstyle = 2; // Caps lock indicator powerline style (0: <, 1: /, 2: ()
|
||||||
|
itemstyle = 2; // Item powerline style (0: <, 1: /, 2: ()
|
||||||
prompt = 1; // Enable prompt powerline (0/1)
|
prompt = 1; // Enable prompt powerline (0/1)
|
||||||
matchcount = 1; // Enable match count powerline (0/1)
|
matchcount = 1; // Enable match count powerline (0/1)
|
||||||
mode = 1; // Enable mode indicator powerline (0/1)
|
mode = 1; // Enable mode indicator powerline (0/1)
|
||||||
caps = 1; // Enable caps lock indicator powerline (0/1)
|
caps = 1; // Enable caps lock indicator powerline (0/1)
|
||||||
|
item = 1; // Enable item powerline (0/1)
|
||||||
} );
|
} );
|
||||||
|
|
||||||
/* Hide options */
|
/* Hide options */
|
||||||
|
|
|
@ -108,10 +108,12 @@ void conf_init(void) {
|
||||||
config_setting_lookup_int(conf, "matchcountstyle", &matchcountpwlstyle); // spmenu.powerline.matchcountstyle
|
config_setting_lookup_int(conf, "matchcountstyle", &matchcountpwlstyle); // spmenu.powerline.matchcountstyle
|
||||||
config_setting_lookup_int(conf, "modestyle", &modepwlstyle); // spmenu.powerline.modestyle
|
config_setting_lookup_int(conf, "modestyle", &modepwlstyle); // spmenu.powerline.modestyle
|
||||||
config_setting_lookup_int(conf, "capsstyle", &capspwlstyle); // spmenu.powerline.capsstyle
|
config_setting_lookup_int(conf, "capsstyle", &capspwlstyle); // spmenu.powerline.capsstyle
|
||||||
|
config_setting_lookup_int(conf, "itemstyle", &itempwlstyle); // spmenu.powerline.itemstyle
|
||||||
config_setting_lookup_int(conf, "prompt", &powerlineprompt); // spmenu.powerline.prompt
|
config_setting_lookup_int(conf, "prompt", &powerlineprompt); // spmenu.powerline.prompt
|
||||||
config_setting_lookup_int(conf, "matchcount", &powerlinecount); // spmenu.powerline.matchcount
|
config_setting_lookup_int(conf, "matchcount", &powerlinecount); // spmenu.powerline.matchcount
|
||||||
config_setting_lookup_int(conf, "mode", &powerlinemode); // spmenu.powerline.mode
|
config_setting_lookup_int(conf, "mode", &powerlinemode); // spmenu.powerline.mode
|
||||||
config_setting_lookup_int(conf, "caps", &powerlinecaps); // spmenu.powerline.caps
|
config_setting_lookup_int(conf, "caps", &powerlinecaps); // spmenu.powerline.caps
|
||||||
|
config_setting_lookup_int(conf, "item", &powerlineitems); // spmenu.powerline.item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
libs/draw.c
22
libs/draw.c
|
@ -92,6 +92,7 @@ int drawitemtext(struct item *item, int x, int y, int w) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_selected(item->index)) {
|
if (is_selected(item->index)) {
|
||||||
|
selitem = 1;
|
||||||
bgcol = col_itemmarkedbg;
|
bgcol = col_itemmarkedbg;
|
||||||
fgcol = col_itemmarkedfg;
|
fgcol = col_itemmarkedfg;
|
||||||
fga = alpha_itemmarkedfg;
|
fga = alpha_itemmarkedfg;
|
||||||
|
@ -115,6 +116,14 @@ int drawitemtext(struct item *item, int x, int y, int w) {
|
||||||
fga = itemn ? alpha_itemnormfg2 : alpha_itemnormfg;
|
fga = itemn ? alpha_itemnormfg2 : alpha_itemnormfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hidepowerline && powerlineitems && selitem && lines > 0) {
|
||||||
|
if (itempwlstyle == 2) {
|
||||||
|
drw_circle(drw, x - plw, y, plw, bh, 0, col_menu, bgcol, alpha_menu, bga);
|
||||||
|
} else {
|
||||||
|
drw_arrow(drw, x - plw, y, plw, bh, 0, itempwlstyle, col_menu, bgcol, alpha_menu, bga);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// parse item text
|
// parse item text
|
||||||
for (wr = 0, rd = 0; item->text[rd]; rd++) {
|
for (wr = 0, rd = 0; item->text[rd]; rd++) {
|
||||||
if (item->text[rd] == '' && item->text[rd + 1] == '[') {
|
if (item->text[rd] == '' && item->text[rd + 1] == '[') {
|
||||||
|
@ -215,6 +224,7 @@ int drawitemtext(struct item *item, int x, int y, int w) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_selected(item->index)) {
|
if (is_selected(item->index)) {
|
||||||
|
selitem = 1;
|
||||||
bgcol = col_itemmarkedbg;
|
bgcol = col_itemmarkedbg;
|
||||||
fgcol = col_itemmarkedfg;
|
fgcol = col_itemmarkedfg;
|
||||||
fga = alpha_itemmarkedfg;
|
fga = alpha_itemmarkedfg;
|
||||||
|
@ -252,6 +262,14 @@ int drawitemtext(struct item *item, int x, int y, int w) {
|
||||||
item->clntext = malloc(sizeof(buffer));
|
item->clntext = malloc(sizeof(buffer));
|
||||||
memcpy(item->clntext, buffer, sizeof(buffer));
|
memcpy(item->clntext, buffer, sizeof(buffer));
|
||||||
|
|
||||||
|
if (!hidepowerline && powerlineitems && selitem && lines > 0) {
|
||||||
|
if (itempwlstyle == 2) {
|
||||||
|
drw_circle(drw, r, y, plw, bh, 1, col_menu, bgcol, alpha_menu, bga);
|
||||||
|
} else {
|
||||||
|
drw_arrow(drw, r, y, plw, bh, 1, itempwlstyle, col_menu, bgcol, alpha_menu, bga);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,9 +321,9 @@ int drawitem(int x, int y, int w) {
|
||||||
for (item = curr; item != next; item = item->right, i++) {
|
for (item = curr; item != next; item = item->right, i++) {
|
||||||
x = drawitemtext(
|
x = drawitemtext(
|
||||||
item,
|
item,
|
||||||
rx + ((i / lines) * ((mw - rx) / columns)),
|
rx + ((i / lines) * ((mw - rx) / columns)) + (powerlineitems ? plw : 0),
|
||||||
y + (((i % lines) + 1) * bh),
|
y + (((i % lines) + 1) * bh),
|
||||||
(mw - rx) / columns
|
(mw - rx) / columns - (powerlineitems ? 2 * plw : 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (item == sel && itemoverride) {
|
if (item == sel && itemoverride) {
|
||||||
|
|
|
@ -40,10 +40,12 @@ static int powerlineprompt = 1; /* Enable powerline for the prompt *
|
||||||
static int powerlinecount = 1; /* Enable powerline for the match count */
|
static int powerlinecount = 1; /* Enable powerline for the match count */
|
||||||
static int powerlinemode = 1; /* Enable powerline for the mode indicator */
|
static int powerlinemode = 1; /* Enable powerline for the mode indicator */
|
||||||
static int powerlinecaps = 1; /* Enable powerline for the caps lock indicator */
|
static int powerlinecaps = 1; /* Enable powerline for the caps lock indicator */
|
||||||
|
static int powerlineitems = 1; /* Enable powerline for the items */
|
||||||
static int promptpwlstyle = 2; /* Prompt powerline style (0: >, 1: \, 2: )) */
|
static int promptpwlstyle = 2; /* Prompt powerline style (0: >, 1: \, 2: )) */
|
||||||
static int matchcountpwlstyle = 2; /* Match count powerline style (0: <, 1: /, 2: () */
|
static int matchcountpwlstyle = 2; /* Match count powerline style (0: <, 1: /, 2: () */
|
||||||
static int modepwlstyle = 2; /* Mode indicator powerline style (0: <, 1: /, 2: () */
|
static int modepwlstyle = 2; /* Mode indicator powerline style (0: <, 1: /, 2: () */
|
||||||
static int capspwlstyle = 2; /* Caps lock indicator powerline style (0: <, 1: /, 2: () */
|
static int capspwlstyle = 2; /* Caps lock indicator powerline style (0: <, 1: /, 2: () */
|
||||||
|
static int itempwlstyle = 2; /* Item powerline style (0: <>, 1: /\, 2: ()) */
|
||||||
|
|
||||||
/* Window properties */
|
/* Window properties */
|
||||||
static int dockproperty = 1; /* Set _NET_WM_WINDOW_TYPE_DOCK */
|
static int dockproperty = 1; /* Set _NET_WM_WINDOW_TYPE_DOCK */
|
||||||
|
|
|
@ -98,10 +98,12 @@ void theme_load(void) {
|
||||||
config_setting_lookup_int(conf, "matchcountstyle", &matchcountpwlstyle); // theme.powerline.matchcountstyle
|
config_setting_lookup_int(conf, "matchcountstyle", &matchcountpwlstyle); // theme.powerline.matchcountstyle
|
||||||
config_setting_lookup_int(conf, "modestyle", &modepwlstyle); // theme.powerline.modestyle
|
config_setting_lookup_int(conf, "modestyle", &modepwlstyle); // theme.powerline.modestyle
|
||||||
config_setting_lookup_int(conf, "capsstyle", &capspwlstyle); // theme.powerline.capsstyle
|
config_setting_lookup_int(conf, "capsstyle", &capspwlstyle); // theme.powerline.capsstyle
|
||||||
|
config_setting_lookup_int(conf, "itemstyle", &itempwlstyle); // theme.powerline.itemstyle
|
||||||
config_setting_lookup_int(conf, "prompt", &powerlineprompt); // theme.powerline.prompt
|
config_setting_lookup_int(conf, "prompt", &powerlineprompt); // theme.powerline.prompt
|
||||||
config_setting_lookup_int(conf, "matchcount", &powerlinecount); // theme.powerline.matchcount
|
config_setting_lookup_int(conf, "matchcount", &powerlinecount); // theme.powerline.matchcount
|
||||||
config_setting_lookup_int(conf, "mode", &powerlinemode); // theme.powerline.mode
|
config_setting_lookup_int(conf, "mode", &powerlinemode); // theme.powerline.mode
|
||||||
config_setting_lookup_int(conf, "caps", &powerlinecaps); // theme.powerline.caps
|
config_setting_lookup_int(conf, "caps", &powerlinecaps); // theme.powerline.caps
|
||||||
|
config_setting_lookup_int(conf, "item", &powerlineitems); // theme.powerline.item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,10 +98,12 @@ ResourcePref resources[] = {
|
||||||
{ "matchcountpwlstyle", INTEGER, &matchcountpwlstyle },
|
{ "matchcountpwlstyle", INTEGER, &matchcountpwlstyle },
|
||||||
{ "modepwlstyle", INTEGER, &modepwlstyle },
|
{ "modepwlstyle", INTEGER, &modepwlstyle },
|
||||||
{ "capspwlstyle", INTEGER, &capspwlstyle },
|
{ "capspwlstyle", INTEGER, &capspwlstyle },
|
||||||
|
{ "itempwlstyle", INTEGER, &itempwlstyle },
|
||||||
{ "powerlineprompt", INTEGER, &powerlineprompt },
|
{ "powerlineprompt", INTEGER, &powerlineprompt },
|
||||||
{ "powerlinecount", INTEGER, &powerlinecount },
|
{ "powerlinecount", INTEGER, &powerlinecount },
|
||||||
{ "powerlinemode", INTEGER, &powerlinemode },
|
{ "powerlinemode", INTEGER, &powerlinemode },
|
||||||
{ "powerlinecaps", INTEGER, &powerlinecaps },
|
{ "powerlinecaps", INTEGER, &powerlinecaps },
|
||||||
|
{ "powerlineitems", INTEGER, &powerlineitems },
|
||||||
{ "dockproperty", INTEGER, &dockproperty },
|
{ "dockproperty", INTEGER, &dockproperty },
|
||||||
{ "globalcolors", INTEGER, &globalcolors },
|
{ "globalcolors", INTEGER, &globalcolors },
|
||||||
{ "coloritems", INTEGER, &coloritems },
|
{ "coloritems", INTEGER, &coloritems },
|
||||||
|
|
2
spmenu.c
2
spmenu.c
|
@ -337,7 +337,7 @@ void calcoffsets(void) {
|
||||||
if (!strcmp(capstext, ""))
|
if (!strcmp(capstext, ""))
|
||||||
capsWidth = 0;
|
capsWidth = 0;
|
||||||
|
|
||||||
n = mw - (promptw + inputw + larrowWidth + rarrowWidth + modeWidth + numberWidth + capsWidth + menumarginv);
|
n = mw - (promptw + inputw + larrowWidth + rarrowWidth + modeWidth + numberWidth + capsWidth + menumarginh);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate which items will begin the next page
|
// calculate which items will begin the next page
|
||||||
|
|
Loading…
Reference in a new issue