aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Yacine Hmito <yacine.hmito@gmail.com>2015-12-15 00:38:26 +0100
committerLibravatar Yacine Hmito <yacine.hmito@gmail.com>2015-12-15 01:15:02 +0100
commit5786fa7e350165743df62c82a376c29984eb1abf (patch)
tree5a33b6cc28ceec3978f9e2f4e5ebf0fbbf2effd3 /sway
parentMerge pull request #321 from gpyh/bar_cmds (diff)
downloadsway-5786fa7e350165743df62c82a376c29984eb1abf.tar.gz
sway-5786fa7e350165743df62c82a376c29984eb1abf.tar.zst
sway-5786fa7e350165743df62c82a376c29984eb1abf.zip
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 053f40fc..31b31eb6 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;
@@ -1685,6 +1686,23 @@ static struct cmd_results *bar_cmd_position(int argc, char **argv) {
1685 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 1686 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
1686} 1687}
1687 1688
1689static struct cmd_results *bar_cmd_status_command(int argc, char **argv) {
1690 struct cmd_results *error = NULL;
1691 if ((error = checkarg(argc, "status_command", EXPECTED_AT_LEAST, 1))) {
1692 return error;
1693 }
1694
1695 if (!config->current_bar) {
1696 return cmd_results_new(CMD_FAILURE, "status_command", "No bar defined.");
1697 }
1698
1699 free(config->current_bar->status_command);
1700 config->current_bar->status_command = join_args(argv, argc);
1701 sway_log(L_DEBUG, "Feeding bar with status command: %s", config->current_bar->status_command);
1702
1703 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
1704}
1705
1688static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) { 1706static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) {
1689 struct cmd_results *error = NULL; 1707 struct cmd_results *error = NULL;
1690 if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) { 1708 if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) {
@@ -1773,7 +1791,7 @@ static struct cmd_handler bar_handlers[] = {
1773 { "output", NULL }, 1791 { "output", NULL },
1774 { "position", bar_cmd_position }, 1792 { "position", bar_cmd_position },
1775 { "seperator_symbol", NULL }, 1793 { "seperator_symbol", NULL },
1776 { "status_command", NULL }, 1794 { "status_command", bar_cmd_status_command },
1777 { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers }, 1795 { "strip_workspace_numbers", bar_cmd_strip_workspace_numbers },
1778 { "tray_output", bar_cmd_tray_output }, 1796 { "tray_output", bar_cmd_tray_output },
1779 { "tray_padding", bar_cmd_tray_padding }, 1797 { "tray_padding", bar_cmd_tray_padding },