summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ISSUE_TEMPLATE.md27
-rw-r--r--include/sway/output.h2
-rw-r--r--sway/desktop/output.c13
-rw-r--r--sway/input/seat.c2
-rw-r--r--sway/ipc-json.c23
-rw-r--r--sway/tree/workspace.c10
6 files changed, 63 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 @@
1Please 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.
2
3Obtain your version like so:
4
5 swaymsg -t get_version
6
7If this doesn't work, use:
8
9 sway -v
10
11* Sway Version:
12
13Obtain a debug log like so:
14
15 sway -d 2> ~/sway.log
16
17This 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.
18
19Upload the debug log to a pastebin service such as [gist.github.com](https://gist.github.com), and link to it below.
20
21* Debug Log:
22
23You 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.
24
25* Configuration File:
26
27Finally, 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,
86 86
87struct sway_output *output_by_name(const char *name); 87struct sway_output *output_by_name(const char *name);
88 88
89struct sway_output *output_by_identifier(const char *identifier);
90
89void output_sort_workspaces(struct sway_output *output); 91void output_sort_workspaces(struct sway_output *output);
90 92
91struct output_config *output_find_config(struct sway_output *output); 93struct 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) {
39 return NULL; 39 return NULL;
40} 40}
41 41
42struct sway_output *output_by_identifier(const char *identifier) {
43 for (int i = 0; i < root->outputs->length; ++i) {
44 struct sway_output *output = root->outputs->items[i];
45 char output_identifier[128];
46 snprintf(output_identifier, sizeof(output_identifier), "%s %s %s", output->wlr_output->make,
47 output->wlr_output->model, output->wlr_output->serial);
48 if (strcasecmp(output_identifier, identifier) == 0) {
49 return output;
50 }
51 }
52 return NULL;
53}
54
42/** 55/**
43 * Rotate a child's position relative to a parent. The parent size is (pw, ph), 56 * Rotate a child's position relative to a parent. The parent size is (pw, ph),
44 * the child position is (*sx, *sy) and its size is (sw, sh). 57 * the child position is (*sx, *sy) and its size is (sw, sh).
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) {
948 if (!seat->has_focus) { 948 if (!seat->has_focus) {
949 return NULL; 949 return NULL;
950 } 950 }
951 if (wl_list_length(&seat->focus_stack) == 0) { 951 if (wl_list_empty(&seat->focus_stack)) {
952 return NULL; 952 return NULL;
953 } 953 }
954 struct sway_seat_node *current = 954 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
229 json_object_object_add(object, "app_id", 229 json_object_object_add(object, "app_id",
230 app_id ? json_object_new_string(app_id) : NULL); 230 app_id ? json_object_new_string(app_id) : NULL);
231 231
232 const char *class = view_get_class(c->view);
233 json_object_object_add(object, "class",
234 class ? json_object_new_string(class) : NULL);
235
236 json_object *marks = json_object_new_array(); 232 json_object *marks = json_object_new_array();
237 list_t *view_marks = c->view->marks; 233 list_t *view_marks = c->view->marks;
238 for (int i = 0; i < view_marks->length; ++i) { 234 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
269 265
270 json_object *window_props = json_object_new_object(); 266 json_object *window_props = json_object_new_object();
271 267
272 json_object_object_add(window_props, "class", 268 const char *class = view_get_class(c->view);
273 class ? json_object_new_string(class) : NULL); 269 if (class) {
270 json_object_object_add(window_props, "class", json_object_new_string(class));
271 }
274 const char *instance = view_get_instance(c->view); 272 const char *instance = view_get_instance(c->view);
275 json_object_object_add(window_props, "instance", 273 if (instance) {
276 instance ? json_object_new_string(instance) : NULL); 274 json_object_object_add(window_props, "instance", json_object_new_string(instance));
277 json_object_object_add(window_props, "title", 275 }
278 c->title ? json_object_new_string(c->title) : NULL); 276 if (c->title) {
277 json_object_object_add(window_props, "title", json_object_new_string(c->title));
278 }
279 279
280 // the transient_for key is always present in i3's output 280 // the transient_for key is always present in i3's output
281 uint32_t parent_id = view_get_x11_parent_id(c->view); 281 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
284 284
285 const char *role = view_get_window_role(c->view); 285 const char *role = view_get_window_role(c->view);
286 if (role) { 286 if (role) {
287 json_object_object_add(window_props, "window_role", 287 json_object_object_add(window_props, "window_role", json_object_new_string(role));
288 json_object_new_string(role));
289 } 288 }
290 289
291 json_object_object_add(object, "window_properties", window_props); 290 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) {
35 struct workspace_config *wsc = workspace_find_config(name); 35 struct workspace_config *wsc = workspace_find_config(name);
36 if (wsc && wsc->output) { 36 if (wsc && wsc->output) {
37 struct sway_output *output = output_by_name(wsc->output); 37 struct sway_output *output = output_by_name(wsc->output);
38 if (!output) {
39 output = output_by_identifier(wsc->output);
40 }
41
38 if (output) { 42 if (output) {
39 return output; 43 return output;
40 } 44 }
@@ -143,7 +147,11 @@ void workspace_consider_destroy(struct sway_workspace *ws) {
143static bool workspace_valid_on_output(const char *output_name, 147static bool workspace_valid_on_output(const char *output_name,
144 const char *ws_name) { 148 const char *ws_name) {
145 struct workspace_config *wsc = workspace_find_config(ws_name); 149 struct workspace_config *wsc = workspace_find_config(ws_name);
146 return !wsc || !wsc->output || strcmp(wsc->output, output_name) == 0; 150 char identifier[128];
151 struct sway_output *output = output_by_name(output_name);
152 output_get_identifier(identifier, sizeof(identifier), output);
153
154 return !wsc || !wsc->output || strcmp(wsc->output, output_name) == 0 || strcasecmp(identifier, output_name) == 0;
147} 155}
148 156
149static void workspace_name_from_binding(const struct sway_binding * binding, 157static void workspace_name_from_binding(const struct sway_binding * binding,