Implement new "i3bar_command" option for bar.

This allows you to specify an alternate path to the i3bar binary.
The userguide docu is included.
This commit is contained in:
Jan-Erik Rediger
2011-11-24 21:53:29 +01:00
committed by Michael Stapelberg
parent 0e6d1909b8
commit f23d675de9
6 changed files with 43 additions and 2 deletions

View File

@ -102,6 +102,7 @@ EOL (\r?\n)
<BAR_POSITION>bottom { yy_pop_state(); return TOK_BAR_BOTTOM; }
<BAR_POSITION>top { yy_pop_state(); return TOK_BAR_TOP; }
<BAR>status_command { WS_STRING; return TOK_BAR_STATUS_COMMAND; }
<BAR>i3bar_command { WS_STRING; return TOK_BAR_I3BAR_COMMAND; }
<BAR>font { WS_STRING; return TOK_BAR_FONT; }
<BAR>workspace_buttons { return TOK_BAR_WORKSPACE_BUTTONS; }
<BAR>verbose { return TOK_BAR_VERBOSE; }

View File

@ -705,6 +705,7 @@ void parse_file(const char *f) {
%token TOK_BAR_BOTTOM "bottom"
%token TOK_BAR_TOP "top"
%token TOK_BAR_STATUS_COMMAND "status_command"
%token TOK_BAR_I3BAR_COMMAND "i3bar_command"
%token TOK_BAR_FONT "font (bar)"
%token TOK_BAR_WORKSPACE_BUTTONS "workspace_buttons"
%token TOK_BAR_VERBOSE "verbose"
@ -1029,6 +1030,7 @@ barlines:
barline:
comment
| bar_status_command
| bar_i3bar_command
| bar_output
| bar_tray_output
| bar_position
@ -1055,6 +1057,15 @@ bar_status_command:
}
;
bar_i3bar_command:
TOK_BAR_I3BAR_COMMAND STR
{
DLOG("should add i3bar_command %s\n", $2);
FREE(current_bar.i3bar_command);
current_bar.i3bar_command = $2;
}
;
bar_output:
TOK_BAR_OUTPUT STR
{

View File

@ -299,6 +299,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
FREE(barconfig->tray_output);
FREE(barconfig->socket_path);
FREE(barconfig->status_command);
FREE(barconfig->i3bar_command);
FREE(barconfig->font);
FREE(barconfig->colors.background);
FREE(barconfig->colors.statusline);

View File

@ -689,8 +689,9 @@ int main(int argc, char *argv[]) {
Barconfig *barconfig;
TAILQ_FOREACH(barconfig, &barconfigs, configs) {
char *command = NULL;
sasprintf(&command, "i3bar --bar_id=%s --socket=\"%s\"",
barconfig->id, current_socketpath);
sasprintf(&command, "%s --bar_id=%s --socket=\"%s\"",
barconfig->i3bar_command ? barconfig->i3bar_command : "i3bar",
barconfig->id, current_socketpath);
LOG("Starting bar process: %s\n", command);
start_application(command, true);
free(command);