diff options
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c new file mode 100644 index 00000000..51363e76 --- /dev/null +++ b/sway/desktop/output.c | |||
@@ -0,0 +1,21 @@ | |||
1 | #include <wayland-server.h> | ||
2 | #include <wlr/types/wlr_output.h> | ||
3 | #include "sway/server.h" | ||
4 | #include "sway/container.h" | ||
5 | #include "sway/workspace.h" | ||
6 | #include "log.h" | ||
7 | |||
8 | void output_add_notify(struct wl_listener *listener, void *data) { | ||
9 | struct sway_server *server = wl_container_of(listener, server, output_add); | ||
10 | struct wlr_output *wlr_output = data; | ||
11 | sway_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); | ||
12 | swayc_t *op = new_output(wlr_output); | ||
13 | if (!sway_assert(op, "Failed to allocate output")) { | ||
14 | return; | ||
15 | } | ||
16 | // Switch to workspace if we need to | ||
17 | if (swayc_active_workspace() == NULL) { | ||
18 | swayc_t *ws = op->children->items[0]; | ||
19 | workspace_switch(ws); | ||
20 | } | ||
21 | } | ||