diff options
-rw-r--r-- | ISSUE_TEMPLATE.md | 27 | ||||
-rw-r--r-- | include/sway/output.h | 2 | ||||
-rw-r--r-- | sway/desktop/output.c | 13 | ||||
-rw-r--r-- | sway/input/input-manager.c | 1 | ||||
-rw-r--r-- | sway/input/seat.c | 2 | ||||
-rw-r--r-- | sway/ipc-json.c | 23 | ||||
-rw-r--r-- | sway/tree/workspace.c | 10 |
7 files changed, 64 insertions, 14 deletions
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..21f0a36e --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,27 @@ +Please include the following four components in your bug report: sway version, debug log, configuration (if applicable), and an explanation of steps taken to reproduce the issue. + +Obtain your version like so: + + swaymsg -t get_version + +If this doesn't work, use: + + sway -v + +* Sway Version: + +Obtain a debug log like so: + + sway -d 2> ~/sway.log + +This will record information about sway's activity when it's running. Briefly reproduce your problem and exit sway. When preparing a debug log, brevity is important - start up sway, do the minimum work necessary to reproduce the error, then close sway. + +Upload the debug log to a pastebin service such as [gist.github.com](https://gist.github.com), and link to it below. + +* Debug Log: + +You should try to reproduce the issue with the default configuration. If you cannot, please reproduce with a minimal configuration, upload the config to a pastebin service, and link to it below. + +* Configuration File: + +Finally, explain the steps you took in plain English to reproduce the problem below. diff --git a/include/sway/output.h b/include/sway/output.h index 369e62ce..22cb352a 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -86,6 +86,8 @@ void output_damage_whole_container(struct sway_output *output, struct sway_output *output_by_name(const char *name); +struct sway_output *output_by_identifier(const char *identifier); + void output_sort_workspaces(struct sway_output *output); struct output_config *output_find_config(struct sway_output *output); diff --git a/sway/desktop/output.c b/sway/desktop/output.c index ed9300bb..4d6c0336 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -39,6 +39,19 @@ struct sway_output *output_by_name(const char *name) { return NULL; } +struct sway_output *output_by_identifier(const char *identifier) { + for (int i = 0; i < root->outputs->length; ++i) { + struct sway_output *output = root->outputs->items[i]; + char output_identifier[128]; + snprintf(output_identifier, sizeof(output_identifier), "%s %s %s", output->wlr_output->make, + output->wlr_output->model, output->wlr_output->serial); + if (strcasecmp(output_identifier, identifier) == 0) { + return output; + } + } + return NULL; +} + /** * Rotate a child's position relative to a parent. The parent size is (pw, ph), * the child position is (*sx, *sy) and its size is (sw, sh). diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 91c45dd1..68445d68 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -431,6 +431,7 @@ void input_manager_set_focus(struct sway_node *node) { struct sway_seat *seat; wl_list_for_each(seat, &server.input->seats, link) { seat_set_focus(seat, node); + seat_consider_warp_to_focus(seat); } } diff --git a/sway/input/seat.c b/sway/input/seat.c index 9d4dc7af..64419afa 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -948,7 +948,7 @@ struct sway_node *seat_get_focus(struct sway_seat *seat) { if (!seat->has_focus) { return NULL; } - if (wl_list_length(&seat->focus_stack) == 0) { + if (wl_list_empty(&seat->focus_stack)) { return NULL; } struct sway_seat_node *current = diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 2cd0cb2d..5c9b3e5a 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -229,10 +229,6 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object json_object_object_add(object, "app_id", app_id ? json_object_new_string(app_id) : NULL); - const char *class = view_get_class(c->view); - json_object_object_add(object, "class", - class ? json_object_new_string(class) : NULL); - json_object *marks = json_object_new_array(); list_t *view_marks = c->view->marks; for (int i = 0; i < view_marks->length; ++i) { @@ -269,13 +265,17 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object json_object *window_props = json_object_new_object(); - json_object_object_add(window_props, "class", - class ? json_object_new_string(class) : NULL); + const char *class = view_get_class(c->view); + if (class) { + json_object_object_add(window_props, "class", json_object_new_string(class)); + } const char *instance = view_get_instance(c->view); - json_object_object_add(window_props, "instance", - instance ? json_object_new_string(instance) : NULL); - json_object_object_add(window_props, "title", - c->title ? json_object_new_string(c->title) : NULL); + if (instance) { + json_object_object_add(window_props, "instance", json_object_new_string(instance)); + } + if (c->title) { + json_object_object_add(window_props, "title", json_object_new_string(c->title)); + } // the transient_for key is always present in i3's output uint32_t parent_id = view_get_x11_parent_id(c->view); @@ -284,8 +284,7 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object const char *role = view_get_window_role(c->view); if (role) { - json_object_object_add(window_props, "window_role", - json_object_new_string(role)); + json_object_object_add(window_props, "window_role", json_object_new_string(role)); } json_object_object_add(object, "window_properties", window_props); diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 27e9ac7a..05cda5c0 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -35,6 +35,10 @@ struct sway_output *workspace_get_initial_output(const char *name) { struct workspace_config *wsc = workspace_find_config(name); if (wsc && wsc->output) { struct sway_output *output = output_by_name(wsc->output); + if (!output) { + output = output_by_identifier(wsc->output); + } + if (output) { return output; } @@ -143,7 +147,11 @@ void workspace_consider_destroy(struct sway_workspace *ws) { static bool workspace_valid_on_output(const char *output_name, const char *ws_name) { struct workspace_config *wsc = workspace_find_config(ws_name); - return !wsc || !wsc->output || strcmp(wsc->output, output_name) == 0; + char identifier[128]; + struct sway_output *output = output_by_name(output_name); + output_get_identifier(identifier, sizeof(identifier), output); + + return !wsc || !wsc->output || strcmp(wsc->output, output_name) == 0 || strcasecmp(identifier, output_name) == 0; } static void workspace_name_from_binding(const struct sway_binding * binding, |