summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Luminarys <kizunanohikari@gmail.com>2015-08-23 12:22:33 -0500
committerLibravatar Luminarys <kizunanohikari@gmail.com>2015-08-23 12:23:01 -0500
commit98fad060e28c81c8340afbb473615f7889a6097a (patch)
tree0960997bc9cd401fce0347e6e7cbbb6a14fe8450
parentDo not log with colors unless stdout is a tty (diff)
downloadsway-98fad060e28c81c8340afbb473615f7889a6097a.tar.gz
sway-98fad060e28c81c8340afbb473615f7889a6097a.tar.zst
sway-98fad060e28c81c8340afbb473615f7889a6097a.zip
Added in glitchy disabling
-rw-r--r--include/config.h1
-rw-r--r--sway/commands.c5
-rw-r--r--sway/container.c4
-rw-r--r--sway/handlers.c11
4 files changed, 21 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h
index c896b423..3d501cbe 100644
--- a/include/config.h
+++ b/include/config.h
@@ -24,6 +24,7 @@ struct sway_mode {
24 24
25struct output_config { 25struct output_config {
26 char *name; 26 char *name;
27 bool enabled;
27 int width, height; 28 int width, height;
28 int x, y; 29 int x, y;
29}; 30};
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) {
372 struct output_config *output = calloc(1, sizeof(struct output_config)); 372 struct output_config *output = calloc(1, sizeof(struct output_config));
373 output->x = output->y = output->width = output->height = -1; 373 output->x = output->y = output->width = output->height = -1;
374 output->name = strdup(argv[0]); 374 output->name = strdup(argv[0]);
375 output->enabled = true;
375 376
376 // TODO: atoi doesn't handle invalid numbers 377 // TODO: atoi doesn't handle invalid numbers
378
379 if (strcmp(argv[1], "disable") == 0) {
380 output->enabled = false;
381 }
377 382
378 int i; 383 int i;
379 for (i = 1; i < argc; ++i) { 384 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) {
70 oc = NULL; 70 oc = NULL;
71 } 71 }
72 72
73 if (oc && !oc->enabled) {
74 return NULL;
75 }
76
73 swayc_t *output = new_swayc(C_OUTPUT); 77 swayc_t *output = new_swayc(C_OUTPUT);
74 if (oc && oc->width != -1 && oc->height != -1) { 78 if (oc && oc->width != -1 && oc->height != -1) {
75 output->width = oc->width; 79 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) {
86static bool handle_output_created(wlc_handle output) { 86static bool handle_output_created(wlc_handle output) {
87 swayc_t *op = new_output(output); 87 swayc_t *op = new_output(output);
88 88
89 if (!op) {
90 return false;
91 }
92
93 wlc_output_focus(output);
89 // Switch to workspace if we need to 94 // Switch to workspace if we need to
90 if (swayc_active_workspace() == NULL) { 95 if (swayc_active_workspace() == NULL) {
96 sway_log(L_INFO, "Focus switch");
91 swayc_t *ws = op->children->items[0]; 97 swayc_t *ws = op->children->items[0];
92 workspace_switch(ws); 98 workspace_switch(ws);
93 } 99 }
100 /*
101 if (wlc_output_get_sleep(wlc_get_focused_output())) {
102 wlc_output_focus(output);
103 }
104 */
94 return true; 105 return true;
95} 106}
96 107