sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 9db15e29b105a903d335ede2d1f468f15014d5ce
parent 18b4959578cf96ed2eada6b3327f25b09eb1853a
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon, 14 Dec 2015 19:29:02 -0500

Merge pull request #323 from gpyh/bar_cmd_status_command

Added bar_cmd_status_command
Diffstat:
Msway/commands.c | 20+++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/sway/commands.c b/sway/commands.c @@ -70,6 +70,7 @@ static sway_cmd bar_cmd_mode; static sway_cmd bar_cmd_hidden_state; static sway_cmd bar_cmd_id; static sway_cmd bar_cmd_position; +static sway_cmd bar_cmd_status_command; static sway_cmd bar_cmd_strip_workspace_numbers; static sway_cmd bar_cmd_tray_output; static sway_cmd bar_cmd_tray_padding; @@ -1671,6 +1672,23 @@ static struct cmd_results *bar_cmd_position(int argc, char **argv) { return cmd_results_new(CMD_SUCCESS, NULL, NULL); } +static struct cmd_results *bar_cmd_status_command(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "status_command", EXPECTED_AT_LEAST, 1))) { + return error; + } + + if (!config->current_bar) { + return cmd_results_new(CMD_FAILURE, "status_command", "No bar defined."); + } + + free(config->current_bar->status_command); + config->current_bar->status_command = join_args(argv, argc); + sway_log(L_DEBUG, "Feeding bar with status command: %s", config->current_bar->status_command); + + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} + static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) { @@ -1759,7 +1777,7 @@ static struct cmd_handler bar_handlers[] = { { "output", NULL }, { "position", bar_cmd_position }, { "seperator_symbol", NULL }, - { "status_command", NULL }, + { "status_command", bar_cmd_status_command }, { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers }, { "tray_output", bar_cmd_tray_output }, { "tray_padding", bar_cmd_tray_padding },