diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-09 14:43:55 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-09 14:43:55 -0400 |
commit | 9f554b10bcdf0e74a517e9564ca9764be41d92c0 (patch) | |
tree | f3796f8b65ed50f479fc896385aaf479eda5961c /sway/commands.c | |
parent | ec2fedf6d0d4d101351bfa03a60beb02c90573fc (diff) | |
parent | 69edcb88eada370ae95b8d19dd63b426f3ce165f (diff) |
Merge pull request #3 from jdiez17/log_colors_option
log, commands: Add log_colors command
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c index 33a5e485..efa72f19 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -146,6 +146,22 @@ int cmd_set(struct sway_config *config, int argc, char **argv) { return 0; } +int cmd_log_colors(struct sway_config *config, int argc, char **argv) { + if (argc != 1) { + sway_log(L_ERROR, "Invalid log_colors command (expected 1 argument, got %d)", argc); + return 1; + } + + if (strcasecmp(argv[0], "no") != 0 && strcasecmp(argv[0], "yes") != 0) { + sway_log(L_ERROR, "Invalid log_colors command (expected `yes` or `no`, got '%s')", argv[0]); + return 1; + } + + sway_log_colors(!strcasecmp(argv[0], "yes")); + return 0; +} + + /* Keep alphabetized */ struct cmd_handler handlers[] = { { "bindsym", cmd_bindsym }, @@ -153,6 +169,7 @@ struct cmd_handler handlers[] = { { "exit", cmd_exit }, { "focus_follows_mouse", cmd_focus_follows_mouse }, { "layout", cmd_layout }, + { "log_colors", cmd_log_colors }, { "set", cmd_set }, }; |