aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-12-14 19:29:02 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-12-14 19:29:02 -0500
commit9db15e29b105a903d335ede2d1f468f15014d5ce (patch)
tree30f08e23991b37f1fcc288133f4d5dd2516e410b /sway
parentMerge pull request #322 from mikkeloscar/default-bar-config (diff)
parentAdded bar_cmd_status_command (diff)
downloadsway-9db15e29b105a903d335ede2d1f468f15014d5ce.tar.gz
sway-9db15e29b105a903d335ede2d1f468f15014d5ce.tar.zst
sway-9db15e29b105a903d335ede2d1f468f15014d5ce.zip
Merge pull request #323 from gpyh/bar_cmd_status_command
Added bar_cmd_status_command
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c
index d2499e28..2b28c472 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -70,6 +70,7 @@ static sway_cmd bar_cmd_mode;
70static sway_cmd bar_cmd_hidden_state; 70static sway_cmd bar_cmd_hidden_state;
71static sway_cmd bar_cmd_id; 71static sway_cmd bar_cmd_id;
72static sway_cmd bar_cmd_position; 72static sway_cmd bar_cmd_position;
73static sway_cmd bar_cmd_status_command;
73static sway_cmd bar_cmd_strip_workspace_numbers; 74static sway_cmd bar_cmd_strip_workspace_numbers;
74static sway_cmd bar_cmd_tray_output; 75static sway_cmd bar_cmd_tray_output;
75static sway_cmd bar_cmd_tray_padding; 76static sway_cmd bar_cmd_tray_padding;
@@ -1671,6 +1672,23 @@ static struct cmd_results *bar_cmd_position(int argc, char **argv) {
1671 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 1672 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
1672} 1673}
1673 1674
1675static struct cmd_results *bar_cmd_status_command(int argc, char **argv) {
1676 struct cmd_results *error = NULL;
1677 if ((error = checkarg(argc, "status_command", EXPECTED_AT_LEAST, 1))) {
1678 return error;
1679 }
1680
1681 if (!config->current_bar) {
1682 return cmd_results_new(CMD_FAILURE, "status_command", "No bar defined.");
1683 }
1684
1685 free(config->current_bar->status_command);
1686 config->current_bar->status_command = join_args(argv, argc);
1687 sway_log(L_DEBUG, "Feeding bar with status command: %s", config->current_bar->status_command);
1688
1689 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
1690}
1691
1674static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) { 1692static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) {
1675 struct cmd_results *error = NULL; 1693 struct cmd_results *error = NULL;
1676 if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) { 1694 if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) {
@@ -1759,7 +1777,7 @@ static struct cmd_handler bar_handlers[] = {
1759 { "output", NULL }, 1777 { "output", NULL },
1760 { "position", bar_cmd_position }, 1778 { "position", bar_cmd_position },
1761 { "seperator_symbol", NULL }, 1779 { "seperator_symbol", NULL },
1762 { "status_command", NULL }, 1780 { "status_command", bar_cmd_status_command },
1763 { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers }, 1781 { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers },
1764 { "tray_output", bar_cmd_tray_output }, 1782 { "tray_output", bar_cmd_tray_output },
1765 { "tray_padding", bar_cmd_tray_padding }, 1783 { "tray_padding", bar_cmd_tray_padding },