Implement new "i3bar_command" option for bar.

This allows you to specify an alternate path to the i3bar binary.
The userguide docu is included.
next
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

@ -796,6 +796,28 @@ bar {
}
---------------------------
=== i3bar command
By default i3 will just pass +i3bar+ and let your shell handle the execution,
searching your +$PATH+ for a correct version.
If you have a different +i3bar+ somewhere or the binary is not in your +$PATH+ you can
tell i3 what to execute.
The specified command will be passed to +sh -c+, so you can use globbing and
have to have correct quoting etc.
*Syntax*:
----------------------
i3bar_command command
----------------------
*Example*:
-------------------------------------------------
bar {
i3bar_command /home/user/bin/i3bar
}
-------------------------------------------------
=== Statusline command
i3bar can run a program and display every line of its +stdout+ output on the

View File

@ -201,6 +201,11 @@ struct Barconfig {
/** Bar position (bottom by default). */
enum { P_BOTTOM = 0, P_TOP = 1 } position;
/** Command that should be run to execute i3bar, give a full path if i3bar is not
* in your $PATH.
* By default just 'i3bar' is executed. */
char *i3bar_command;
/** Command that should be run to get a statusline, for example 'i3status'.
* Will be passed to the shell. */
char *status_command;

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);