diff options
author | Luminarys <kizunanohikari@gmail.com> | 2015-08-23 12:22:33 -0500 |
---|---|---|
committer | Luminarys <kizunanohikari@gmail.com> | 2015-08-23 12:23:01 -0500 |
commit | 98fad060e28c81c8340afbb473615f7889a6097a (patch) | |
tree | 0960997bc9cd401fce0347e6e7cbbb6a14fe8450 /sway | |
parent | e2322414666488945ffcbcab06f9cca95ff731d3 (diff) | |
download | sway-98fad060e28c81c8340afbb473615f7889a6097a.tar.xz |
Added in glitchy disabling
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 5 | ||||
-rw-r--r-- | sway/container.c | 4 | ||||
-rw-r--r-- | sway/handlers.c | 11 |
3 files changed, 20 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c index 5de1fb0c..9a0bc076 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -372,8 +372,13 @@ static bool cmd_output(struct sway_config *config, int argc, char **argv) { struct output_config *output = calloc(1, sizeof(struct output_config)); output->x = output->y = output->width = output->height = -1; output->name = strdup(argv[0]); + output->enabled = true; // TODO: atoi doesn't handle invalid numbers + + if (strcmp(argv[1], "disable") == 0) { + output->enabled = false; + } int i; for (i = 1; i < argc; ++i) { diff --git a/sway/container.c b/sway/container.c index 127e1ecd..6debeea3 100644 --- a/sway/container.c +++ b/sway/container.c @@ -70,6 +70,10 @@ swayc_t *new_output(wlc_handle handle) { oc = NULL; } + if (oc && !oc->enabled) { + return NULL; + } + swayc_t *output = new_swayc(C_OUTPUT); if (oc && oc->width != -1 && oc->height != -1) { output->width = oc->width; diff --git a/sway/handlers.c b/sway/handlers.c index e4018811..9fca6387 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -86,11 +86,22 @@ swayc_t *container_under_pointer(void) { static bool handle_output_created(wlc_handle output) { swayc_t *op = new_output(output); + if (!op) { + return false; + } + + wlc_output_focus(output); // Switch to workspace if we need to if (swayc_active_workspace() == NULL) { + sway_log(L_INFO, "Focus switch"); swayc_t *ws = op->children->items[0]; workspace_switch(ws); } + /* + if (wlc_output_get_sleep(wlc_get_focused_output())) { + wlc_output_focus(output); + } + */ return true; } |