diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sway/commands.c b/sway/commands.c index 4eb733ba..89dd0936 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -5,11 +5,12 @@ #include <string.h> #include <ctype.h> #include "stringop.h" +#include "log.h" #include "commands.h" int cmd_set(struct sway_config *config, int argc, char **argv) { if (argc != 2) { - fprintf(stderr, "Invalid set command (expected 2 arguments, got %d)\n", argc); + sway_log(L_ERROR, "Invalid set command (expected 2 arguments, got %d)", argc); return 1; } struct sway_variable *var = malloc(sizeof(struct sway_variable)); @@ -23,7 +24,7 @@ int cmd_set(struct sway_config *config, int argc, char **argv) { int cmd_bindsym(struct sway_config *config, int argc, char **argv) { if (argc < 2) { - fprintf(stderr, "Invalid bindsym command (expected 2 arguments, got %d)\n", argc); + sway_log(L_ERROR, "Invalid set command (expected 2 arguments, got %d)", argc); return 1; } argv[0] = do_var_replacement(config, argv[0]); @@ -39,7 +40,7 @@ int cmd_bindsym(struct sway_config *config, int argc, char **argv) { // TODO: Parse modifier keys xkb_keysym_t sym = xkb_keysym_from_name(split->items[i], XKB_KEYSYM_CASE_INSENSITIVE); if (!sym) { - fprintf(stderr, "bindsym - unknown key '%s'\n", (char *)split->items[i]); + sway_log(L_ERROR, "bindsym - unknown key %s", (char *)split->items[i]); // Ignore for now, we need to deal with modifier keys // return 1; } @@ -52,7 +53,7 @@ int cmd_bindsym(struct sway_config *config, int argc, char **argv) { // TODO: Check if there are other commands with this key binding list_add(config->current_mode->bindings, binding); - fprintf(stderr, "bindsym - Bound %s to command %s\n", argv[0], binding->command); + sway_log(L_DEBUG, "bindsym - Bound %s to command %s", argv[0], binding->command); return 0; } @@ -139,7 +140,7 @@ int handle_command(struct sway_config *config, char *exec) { } struct cmd_handler *handler = find_handler(handlers, sizeof(handlers) / sizeof(struct cmd_handler), cmd); if (handler == NULL) { - fprintf(stderr, "Unknown command '%s'\n", cmd); + sway_log(L_ERROR, "Unknown command '%s'", cmd); return 0; // TODO: return error, probably } int argc; |