mirror of
https://github.com/swaywm/sway.git
synced 2024-11-16 13:13:17 +00:00
Merge pull request #323 from gpyh/bar_cmd_status_command
Added bar_cmd_status_command
This commit is contained in:
commit
9db15e29b1
|
@ -70,6 +70,7 @@ static sway_cmd bar_cmd_mode;
|
||||||
static sway_cmd bar_cmd_hidden_state;
|
static sway_cmd bar_cmd_hidden_state;
|
||||||
static sway_cmd bar_cmd_id;
|
static sway_cmd bar_cmd_id;
|
||||||
static sway_cmd bar_cmd_position;
|
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_strip_workspace_numbers;
|
||||||
static sway_cmd bar_cmd_tray_output;
|
static sway_cmd bar_cmd_tray_output;
|
||||||
static sway_cmd bar_cmd_tray_padding;
|
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);
|
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) {
|
static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) {
|
||||||
struct cmd_results *error = NULL;
|
struct cmd_results *error = NULL;
|
||||||
if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) {
|
if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) {
|
||||||
|
@ -1759,7 +1777,7 @@ static struct cmd_handler bar_handlers[] = {
|
||||||
{ "output", NULL },
|
{ "output", NULL },
|
||||||
{ "position", bar_cmd_position },
|
{ "position", bar_cmd_position },
|
||||||
{ "seperator_symbol", NULL },
|
{ "seperator_symbol", NULL },
|
||||||
{ "status_command", NULL },
|
{ "status_command", bar_cmd_status_command },
|
||||||
{ "strip_workspace_numbers", bar_cmd_strip_workspace_numbers },
|
{ "strip_workspace_numbers", bar_cmd_strip_workspace_numbers },
|
||||||
{ "tray_output", bar_cmd_tray_output },
|
{ "tray_output", bar_cmd_tray_output },
|
||||||
{ "tray_padding", bar_cmd_tray_padding },
|
{ "tray_padding", bar_cmd_tray_padding },
|
||||||
|
|
Loading…
Reference in a new issue