diff options
author | Jose Diez <jose.manuel.diez@gmail.com> | 2015-08-10 22:31:23 +0200 |
---|---|---|
committer | Jose Diez <jose.manuel.diez@gmail.com> | 2015-08-10 22:49:50 +0200 |
commit | 8cc2c6fa7a4b5e8b2d2030033a4bb9f7df45fc42 (patch) | |
tree | d079178cb01d2dd0bbb58792133d64e9cc31d4e7 /sway/commands.c | |
parent | caee41b7775d6e7eacc37837b31d92808e1a34de (diff) |
Basic workspace functionality
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c index 2ce24fa4..94d5a7ff 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -10,6 +10,7 @@ #include "layout.h" #include "movement.h" #include "log.h" +#include "workspace.h" #include "commands.h" struct modifier_key { @@ -262,6 +263,21 @@ int cmd_fullscreen(struct sway_config *config, int argc, char **argv) { return 1; } +int cmd_workspace(struct sway_config *config, int argc, char **argv) { + if (argc != 1) { + sway_log(L_ERROR, "Invalid workspace command (expected 1 arguments, got %d)", argc); + return 1; + } + + swayc_t *workspace = workspace_find_by_name(argv[0]); + if (!workspace) { + workspace = workspace_create(argv[0]); + } else sway_log(L_DEBUG, "workspace exists, all ok"); + + workspace_switch(workspace); + return 1; +} + /* Keep alphabetized */ struct cmd_handler handlers[] = { { "bindsym", cmd_bindsym }, @@ -276,7 +292,8 @@ struct cmd_handler handlers[] = { { "reload", cmd_reload }, { "set", cmd_set }, { "splith", cmd_splith }, - { "splitv", cmd_splitv } + { "splitv", cmd_splitv }, + { "workspace", cmd_workspace } }; char **split_directive(char *line, int *argc) { |