From 472dce662116bb13101e27ecb4b05b803ee21e64 Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Wed, 1 Jul 2020 01:08:04 -0400 Subject: [PATCH 01/21] commands/move: unwrap workspace container on move to new workspace If moving e.g. `T[app app]` into a new workspace with `workspace_layout tabbed`, then post-move the tree in that workspace will be `T[T[app app]]`. This still happens with horizontal or vertical workspace layout, but is less visible since those containers have no decorations. Fixes #5426. (cherry picked from commit 92891fb1edef5136ae4eb35fec5b8523f031be81) --- include/sway/tree/workspace.h | 3 +++ sway/commands/move.c | 10 +++++++--- sway/tree/workspace.c | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index 41b597963..1adbe68a2 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h @@ -105,6 +105,9 @@ struct sway_container *workspace_find_container(struct sway_workspace *ws, */ struct sway_container *workspace_wrap_children(struct sway_workspace *ws); +void workspace_unwrap_children(struct sway_workspace *ws, + struct sway_container *wrap); + void workspace_detach(struct sway_workspace *workspace); void workspace_add_tiling(struct sway_workspace *workspace, diff --git a/sway/commands/move.c b/sway/commands/move.c index cdbad13e1..5851520e9 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -208,9 +208,13 @@ static void container_move_to_workspace(struct sway_container *container, } } else { container_detach(container); - container->width = container->height = 0; - container->width_fraction = container->height_fraction = 0; - workspace_add_tiling(workspace, container); + if (workspace_is_empty(workspace) && container->children) { + workspace_unwrap_children(workspace, container); + } else { + container->width = container->height = 0; + container->width_fraction = container->height_fraction = 0; + workspace_add_tiling(workspace, container); + } container_update_representation(container); } if (container->view) { diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 0fa28951e..3bcba8e54 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -641,6 +641,21 @@ struct sway_container *workspace_wrap_children(struct sway_workspace *ws) { return middle; } +void workspace_unwrap_children(struct sway_workspace *ws, + struct sway_container *wrap) { + if (!sway_assert(workspace_is_empty(ws), + "target workspace must be empty")) { + return; + } + + ws->layout = wrap->layout; + while (wrap->children->length) { + struct sway_container *child = wrap->children->items[0]; + container_detach(child); + workspace_add_tiling(ws, child); + } +} + void workspace_detach(struct sway_workspace *workspace) { struct sway_output *output = workspace->output; int index = list_find(output->workspaces, workspace); From 70cc5236ecb0651f042e9dc6d8eb0c0844ef8583 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 2 Jul 2020 10:59:16 +0200 Subject: [PATCH 02/21] seat: fix segfault in sway_input_method_relay_set_focus sway_input_method_relay_set_focus was called before sway_input_method_relay_init. Closes: https://github.com/swaywm/sway/issues/5503 (cherry picked from commit 1bfbf262cc501db7bd94f651ea16aa4af607f548) --- sway/input/seat.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sway/input/seat.c b/sway/input/seat.c index a54bc2e7d..1e9873604 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -572,14 +572,6 @@ struct sway_seat *seat_create(const char *seat_name) { seat->deferred_bindings = create_list(); - if (!wl_list_empty(&server.input->seats)) { - // Since this is not the first seat, attempt to set initial focus - struct sway_seat *current_seat = input_manager_current_seat(); - struct sway_node *current_focus = - seat_get_focus_inactive(current_seat, &root->node); - seat_set_focus(seat, current_focus); - } - wl_signal_add(&root->events.new_node, &seat->new_node); seat->new_node.notify = handle_new_node; @@ -604,8 +596,17 @@ struct sway_seat *seat_create(const char *seat_name) { sway_input_method_relay_init(seat, &seat->im_relay); + bool first = wl_list_empty(&server.input->seats); wl_list_insert(&server.input->seats, &seat->link); + if (!first) { + // Since this is not the first seat, attempt to set initial focus + struct sway_seat *current_seat = input_manager_current_seat(); + struct sway_node *current_focus = + seat_get_focus_inactive(current_seat, &root->node); + seat_set_focus(seat, current_focus); + } + seatop_begin_default(seat); return seat; From 1c5046d7e421ea5d90a360e3e08ea2ff67db4561 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 2 Jul 2020 13:48:57 +0200 Subject: [PATCH 03/21] Don't set xwayland cursor when wlr_xwayland failed This causes a NULL pointer dereference. (cherry picked from commit dfccd2a4c483a6ff03350cd4ac5e3fada1f40f2e) --- sway/input/seat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/input/seat.c b/sway/input/seat.c index 1e9873604..656e3e7e8 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -925,7 +925,7 @@ void seat_configure_xcursor(struct sway_seat *seat) { } #if HAVE_XWAYLAND - if (config->xwayland && (!server.xwayland.xcursor_manager || + if (server.xwayland.wlr_xwayland && (!server.xwayland.xcursor_manager || !xcursor_manager_is_named(server.xwayland.xcursor_manager, cursor_theme) || server.xwayland.xcursor_manager->size != cursor_size)) { From 2cc61bbbbeca81ae1961d4628d5844ce371f49e8 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 2 Jul 2020 13:50:24 +0200 Subject: [PATCH 04/21] Unset DISPLAY when wlr_xwayland fails Avoids having applications connect to a leftover DISPLAY when Xwayland fails to initialize. (cherry picked from commit eb4fa183088d0361e2492780e303e2965c5ecae1) --- sway/server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sway/server.c b/sway/server.c index c036396f3..ff848450d 100644 --- a/sway/server.c +++ b/sway/server.c @@ -202,6 +202,7 @@ bool server_start(struct sway_server *server) { config->xwayland == XWAYLAND_MODE_LAZY); if (!server->xwayland.wlr_xwayland) { sway_log(SWAY_ERROR, "Failed to start Xwayland"); + unsetenv("DISPLAY"); } else { wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface, &server->xwayland_surface); From cdff693e2ec13954831e423008241ce28dee538f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 2 Jul 2020 12:14:52 +0200 Subject: [PATCH 05/21] tree/view: fix segfault in view_update_title xdg-shell doesn't allow clients to set the title to NULL, so we shouldn't need to call wlr_foreign_toplevel_handle_v1_set_title with an empty string to reset the old one. Closes: https://github.com/swaywm/sway/issues/5488 (cherry picked from commit b5a35c484f651e25b226c9661669c8a40439f09b) --- sway/tree/view.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/tree/view.c b/sway/tree/view.c index 53c11a32e..ac3147953 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -1171,7 +1171,7 @@ void view_update_title(struct sway_view *view, bool force) { ipc_event_window(view->container, "title"); - if (view->foreign_toplevel) { + if (view->foreign_toplevel && title) { wlr_foreign_toplevel_handle_v1_set_title(view->foreign_toplevel, title); } } From c199c8d6ea3fb77697040f3d814af8d76c6e6d2d Mon Sep 17 00:00:00 2001 From: wb9688 Date: Tue, 31 Dec 2019 18:31:45 +0100 Subject: [PATCH 06/21] Replace unprintable characters in input device id (cherry picked from commit 17ff13fc84fd74ddcee68a302af156d7bf81ed85) --- sway/input/input-manager.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 69342c731..f04a8ce09 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -70,7 +70,8 @@ char *input_device_get_identifier(struct wlr_input_device *device) { char *p = name; for (; *p; ++p) { - if (*p == ' ') { + // There are in fact input devices with unprintable characters in its name + if (*p == ' ' || !isprint(*p)) { *p = '_'; } } From 83382f0b4ebcfeb05da57b6432cb2c08e30dde5c Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Wed, 1 Jul 2020 03:20:38 -0400 Subject: [PATCH 07/21] commands/move: maintain workspace_layout when moving Fixes #5157. (cherry picked from commit b4a75a1ab2a72842830aeea37733311f85e6f660) --- sway/commands/move.c | 10 ++++++---- sway/tree/container.c | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sway/commands/move.c b/sway/commands/move.c index 5851520e9..038390832 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -275,12 +275,11 @@ static void workspace_rejigger(struct sway_workspace *ws, return; } container_detach(child); - struct sway_container *new_parent = workspace_wrap_children(ws); + workspace_wrap_children(ws); int index = move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_UP ? 0 : 1; workspace_insert_tiling(ws, child, index); - container_flatten(new_parent); ws->layout = move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_RIGHT ? L_HORIZ : L_VERT; @@ -349,8 +348,11 @@ static bool container_move_in_direction(struct sway_container *container, container_insert_child(current->parent, container, index + (offs < 0 ? 0 : 1)); } else { - workspace_insert_tiling(current->workspace, container, - index + (offs < 0 ? 0 : 1)); + struct sway_workspace *ws = current->workspace; + workspace_insert_tiling(ws, + container_split(container, + output_get_default_layout(ws->output)), + index + (offs < 0 ? 0 : 1)); } return true; } diff --git a/sway/tree/container.c b/sway/tree/container.c index 4cc42747d..fa1598ef9 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -1329,6 +1329,14 @@ void container_detach(struct sway_container *child) { container_update_representation(old_parent); node_set_dirty(&old_parent->node); } else if (old_workspace) { + // We may have removed the last tiling child from the workspace. If the + // workspace layout was e.g. tabbed, then at this point it may be just + // H[]. So, reset it to the default (e.g. T[]) for next time. + if (!old_workspace->tiling->length) { + old_workspace->layout = + output_get_default_layout(old_workspace->output); + } + workspace_update_representation(old_workspace); node_set_dirty(&old_workspace->node); } From 585cf904c526ee8187deb238ec7728e313b3c422 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 4 Jul 2020 11:29:54 +0000 Subject: [PATCH 08/21] protocols: sync wlr-layer-shell-unstable-v1 with wlroots (cherry picked from commit 1d149230ea1fbe7bc5ac906e235db3c1fdc63afa) --- protocols/wlr-layer-shell-unstable-v1.xml | 52 +++++++++++++++++------ 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/protocols/wlr-layer-shell-unstable-v1.xml b/protocols/wlr-layer-shell-unstable-v1.xml index f29eb8796..fa67001df 100644 --- a/protocols/wlr-layer-shell-unstable-v1.xml +++ b/protocols/wlr-layer-shell-unstable-v1.xml @@ -1,5 +1,5 @@ - + Copyright © 2017 Drew DeVault @@ -25,7 +25,7 @@ THIS SOFTWARE. - + Clients can use this interface to assign the surface_layer role to wl_surfaces. Such surfaces are assigned to a "layer" of the output and @@ -82,17 +82,27 @@ + + + + + + This request indicates that the client will not use the layer_shell + object any more. Objects that have been created through this instance + are not affected. + + - + An interface that may be implemented by a wl_surface, for surfaces that are designed to be rendered as a layer of a stacked desktop-like environment. - Layer surface state (size, anchor, exclusive zone, margin, interactivity) - is double-buffered, and will be applied at the time wl_surface.commit of - the corresponding wl_surface is called. + Layer surface state (layer, size, anchor, exclusive zone, + margin, interactivity) is double-buffered, and will be applied at the + time wl_surface.commit of the corresponding wl_surface is called. @@ -115,7 +125,7 @@ Requests that the compositor anchor the surface to the specified edges - and corners. If two orthoginal edges are specified (e.g. 'top' and + and corners. If two orthogonal edges are specified (e.g. 'top' and 'left'), then the anchor point will be the intersection of the edges (e.g. the top left corner of the output); otherwise the anchor point will be centered on that edge, or in the center if none is specified. @@ -127,19 +137,24 @@ - Requests that the compositor avoids occluding an area of the surface - with other surfaces. The compositor's use of this information is + Requests that the compositor avoids occluding an area with other + surfaces. The compositor's use of this information is implementation-dependent - do not assume that this region will not actually be occluded. - A positive value is only meaningful if the surface is anchored to an - edge, rather than a corner. The zone is the number of surface-local - coordinates from the edge that are considered exclusive. + A positive value is only meaningful if the surface is anchored to one + edge or an edge and both perpendicular edges. If the surface is not + anchored, anchored to only two perpendicular edges (a corner), anchored + to only two parallel edges or anchored to all edges, a positive value + will be treated the same as zero. + + A positive zone is the distance from the edge in surface-local + coordinates to consider exclusive. Surfaces that do not wish to have an exclusive zone may instead specify how they should interact with surfaces that do. If set to zero, the surface indicates that it would like to be moved to avoid occluding - surfaces with a positive excluzive zone. If set to -1, the surface + surfaces with a positive exclusive zone. If set to -1, the surface indicates that it would not like to be moved to accommodate for other surfaces, and the compositor should extend it all the way to the edges it is anchored to. @@ -281,5 +296,16 @@ + + + + + + Change the layer that the surface is rendered on. + + Layer is double-buffered, see wl_surface.commit. + + + From f5ba5cbcf6b486ba8422245ed982f354ba84e2d2 Mon Sep 17 00:00:00 2001 From: Geoffrey Casper Date: Sat, 4 Jul 2020 12:28:19 -0400 Subject: [PATCH 09/21] Reload command now matches i3's implementation (cherry picked from commit ea3ba203cc65671d9bf9da5ddbc698b18ed7685c) --- include/sway/config.h | 1 + sway/commands/reload.c | 14 ++++++++++++-- sway/config.c | 1 + sway/sway.5.scd | 4 +++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/sway/config.h b/include/sway/config.h index b3fd66681..5ad240d34 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -500,6 +500,7 @@ struct sway_config { struct side_gaps gaps_outer; list_t *config_chain; + bool user_config_path; const char *current_config_path; const char *current_config; int current_config_line_number; diff --git a/sway/commands/reload.c b/sway/commands/reload.c index 19ec065cd..3c994d54f 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c @@ -22,7 +22,12 @@ static void do_reload(void *data) { list_add(bar_ids, strdup(bar->id)); } - if (!load_main_config(config->current_config_path, true, false)) { + const char *path = NULL; + if (config->user_config_path) { + path = config->current_config_path; + } + + if (!load_main_config(path, true, false)) { sway_log(SWAY_ERROR, "Error(s) reloading config"); list_free_items_and_destroy(bar_ids); return; @@ -55,7 +60,12 @@ struct cmd_results *cmd_reload(int argc, char **argv) { return error; } - if (!load_main_config(config->current_config_path, true, true)) { + const char *path = NULL; + if (config->user_config_path) { + path = config->current_config_path; + } + + if (!load_main_config(path, true, true)) { return cmd_results_new(CMD_FAILURE, "Error(s) reloading config."); } diff --git a/sway/config.c b/sway/config.c index bcf8d56fc..71382b864 100644 --- a/sway/config.c +++ b/sway/config.c @@ -447,6 +447,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { } } + config->user_config_path = file ? true : false; config->current_config_path = path; list_add(config->config_chain, real_path); diff --git a/sway/sway.5.scd b/sway/sway.5.scd index f4323f65e..fed4c3c77 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd @@ -272,7 +272,9 @@ set|plus|minus optional comment argument is ignored, but logged for debugging purposes. *reload* - Reloads the sway config file and applies any changes. + Reloads the sway config file and applies any changes. The config file is + located at path specified by the command line arguments when started, + otherwise according to the priority stated in *sway*(1). *rename workspace* [] to Rename either or the focused workspace to the From d5f5885c941d9f74f131734b253133108c759e20 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 10 Jul 2020 18:04:45 +0200 Subject: [PATCH 10/21] config/output: don't change output state before commit Previously, we called output_disable prior to wlr_output_commit. This mutates Sway's output state before the output commit actually succeeds. This results in Sway's state getting out-of-sync with wlroots'. An alternative fix [1] was to revert the changes made by output_disable in case of failure. This is a little complicated. Instead, this patch makes it so Sway's internal state is never changed before a successful wlr_output commit. We had two output flags: enabled and configured. However enabled was set prior to the output becoming enabled, and was used to prevent the output event handlers (specifically, the mode handler) from calling apply_output_config again (infinite loop). Rename enabled to enabling and use it exclusively for this purpose. Rename configure to enabled, because that's what it really means. [1]: https://github.com/swaywm/sway/pull/5521 Closes: https://github.com/swaywm/sway/issues/5483 (cherry picked from commit 5432f00adfdd8375fb422ad9033253d17f04efc7) --- include/sway/output.h | 4 ++-- sway/config/output.c | 26 ++++++++++++-------------- sway/desktop/output.c | 8 ++++---- sway/input/cursor.c | 4 ++-- sway/tree/output.c | 7 +++---- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/include/sway/output.h b/include/sway/output.h index cabb4b557..f27f6344a 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -36,7 +36,7 @@ struct sway_output { // last applied mode when the output is DPMS'ed struct wlr_output_mode *current_mode; - bool enabled, configured; + bool enabling, enabled; list_t *workspaces; struct sway_output_state current; @@ -98,7 +98,7 @@ struct sway_output *all_output_by_name_or_id(const char *name_or_id); void output_sort_workspaces(struct sway_output *output); -void output_configure(struct sway_output *output); +void output_enable(struct sway_output *output); void output_disable(struct sway_output *output); diff --git a/sway/config/output.c b/sway/config/output.c index 68aafbe1c..b59cabd4e 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -397,17 +397,8 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { struct wlr_output *wlr_output = output->wlr_output; - bool was_enabled = output->enabled; - if (oc && !oc->enabled) { - // Output is configured to be disabled - sway_log(SWAY_DEBUG, "Disabling output %s", oc->name); - if (output->enabled) { - output_disable(output); - wlr_output_layout_remove(root->output_layout, wlr_output); - } - } else { - output->enabled = true; - } + // Flag to prevent the output mode event handler from calling us + output->enabling = (!oc || oc->enabled); queue_output_config(oc, output); @@ -421,11 +412,18 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { // Leave the output disabled for now and try again when the output gets // the mode we asked for. sway_log(SWAY_ERROR, "Failed to commit output %s", wlr_output->name); - output->enabled = was_enabled; + output->enabling = false; return false; } + output->enabling = false; + if (oc && !oc->enabled) { + sway_log(SWAY_DEBUG, "Disabling output %s", oc->name); + if (output->enabled) { + output_disable(output); + wlr_output_layout_remove(root->output_layout, wlr_output); + } return true; } @@ -468,8 +466,8 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { output->width = output_box->width; output->height = output_box->height; - if (!output->configured) { - output_configure(output); + if (!output->enabled) { + output_enable(output); } if (oc && oc->max_render_time >= 0) { diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 4a51b5cc7..5fdaba680 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -844,7 +844,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) { static void handle_mode(struct wl_listener *listener, void *data) { struct sway_output *output = wl_container_of(listener, output, mode); - if (!output->configured && !output->enabled) { + if (!output->enabled && !output->enabling) { struct output_config *oc = find_output_config(output); if (output->wlr_output->current_mode != NULL && (!oc || oc->enabled)) { @@ -857,7 +857,7 @@ static void handle_mode(struct wl_listener *listener, void *data) { } return; } - if (!output->enabled || !output->configured) { + if (!output->enabled) { return; } arrange_layers(output); @@ -869,7 +869,7 @@ static void handle_mode(struct wl_listener *listener, void *data) { static void handle_transform(struct wl_listener *listener, void *data) { struct sway_output *output = wl_container_of(listener, output, transform); - if (!output->enabled || !output->configured) { + if (!output->enabled) { return; } arrange_layers(output); @@ -886,7 +886,7 @@ static void update_textures(struct sway_container *con, void *data) { static void handle_scale(struct wl_listener *listener, void *data) { struct sway_output *output = wl_container_of(listener, output, scale); - if (!output->enabled || !output->configured) { + if (!output->enabled) { return; } arrange_layers(output); diff --git a/sway/input/cursor.c b/sway/input/cursor.c index d10ba444b..0d5b076b0 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -99,8 +99,8 @@ struct sway_node *node_at_coords( return NULL; } struct sway_output *output = wlr_output->data; - if (!output || !output->configured) { - // output is being destroyed or is being configured + if (!output || !output->enabled) { + // output is being destroyed or is being enabled return NULL; } double ox = lx, oy = ly; diff --git a/sway/tree/output.c b/sway/tree/output.c index 9a10c6a89..ae3c3abfc 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -110,12 +110,12 @@ struct sway_output *output_create(struct wlr_output *wlr_output) { return output; } -void output_configure(struct sway_output *output) { - if (!sway_assert(!output->configured, "output is already configured")) { +void output_enable(struct sway_output *output) { + if (!sway_assert(!output->enabled, "output is already enabled")) { return; } struct wlr_output *wlr_output = output->wlr_output; - output->configured = true; + output->enabled = true; list_add(root->outputs, output); restore_workspaces(output); @@ -262,7 +262,6 @@ void output_disable(struct sway_output *output) { list_del(root->outputs, index); output->enabled = false; - output->configured = false; output->current_mode = NULL; arrange_root(); From 3d6010e48061fca665d8ec934dc6aa2b9816650c Mon Sep 17 00:00:00 2001 From: Wai Hon Law Date: Sat, 11 Jul 2020 16:52:41 -0700 Subject: [PATCH 11/21] Make the default workspace commands compatible with i3 **Problem** When I rename the workspace to something like "1:web", `$mod+1` does not move to the "1:web" with the default config. This breaks the expectation of i3 users. **Cause** The default Sway binding for `$mod+1` does not have the number keyword: ``` bindsym $mod+1 workspace 1 ``` Instead, the default Sway binding for `$mod+1` is ``` bindsym Mod1+1 workspace number $ws1 ``` https://github.com/i3/i3/commit/e6662df114329ba45bd1d117c731b3dc8bdd13fb is the corresponding commit from i3. (cherry picked from commit 585236f1687930d36e1d47d69e0a45fe3dcbd0cf) --- config.in | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/config.in b/config.in index 67c748ba3..559431693 100644 --- a/config.in +++ b/config.in @@ -112,27 +112,27 @@ output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill # Workspaces: # # Switch to workspace - bindsym $mod+1 workspace 1 - bindsym $mod+2 workspace 2 - bindsym $mod+3 workspace 3 - bindsym $mod+4 workspace 4 - bindsym $mod+5 workspace 5 - bindsym $mod+6 workspace 6 - bindsym $mod+7 workspace 7 - bindsym $mod+8 workspace 8 - bindsym $mod+9 workspace 9 - bindsym $mod+0 workspace 10 + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 # Move focused container to workspace - bindsym $mod+Shift+1 move container to workspace 1 - bindsym $mod+Shift+2 move container to workspace 2 - bindsym $mod+Shift+3 move container to workspace 3 - bindsym $mod+Shift+4 move container to workspace 4 - bindsym $mod+Shift+5 move container to workspace 5 - bindsym $mod+Shift+6 move container to workspace 6 - bindsym $mod+Shift+7 move container to workspace 7 - bindsym $mod+Shift+8 move container to workspace 8 - bindsym $mod+Shift+9 move container to workspace 9 - bindsym $mod+Shift+0 move container to workspace 10 + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 # Note: workspaces can have any name you want, not just numbers. # We just use 1-10 as the default. # From 773e745f52ce0d098188c8cf4ca04b81a074bb4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Gro=C3=9Fe=20Sundrup?= Date: Sun, 12 Jul 2020 13:57:30 +0200 Subject: [PATCH 12/21] rephrase swayidle-timout example to improve readability (cherry picked from commit 10ec97c073ea7c06f7c129a4baa4576783248148) --- config.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config.in b/config.in index 559431693..08703bef2 100644 --- a/config.in +++ b/config.in @@ -37,8 +37,7 @@ output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill # # exec swayidle -w \ # timeout 300 'swaylock -f -c 000000' \ -# timeout 600 'swaymsg "output * dpms off"' \ -# resume 'swaymsg "output * dpms on"' \ +# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ # before-sleep 'swaylock -f -c 000000' # # This will lock your screen after 300 seconds of inactivity, then turn off From 863b9c8ad9c56ea2f984edce53d46b184c9ae698 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 12 Jul 2020 16:50:11 +0200 Subject: [PATCH 13/21] Assert output is found before removing from list References: https://github.com/swaywm/sway/issues/5483 (cherry picked from commit 9bb70283e967037e6d57bc863ef96d3b5185a989) --- sway/tree/output.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sway/tree/output.c b/sway/tree/output.c index ae3c3abfc..d600c5c31 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -251,6 +251,11 @@ void output_disable(struct sway_output *output) { if (!sway_assert(output->enabled, "Expected an enabled output")) { return; } + int index = list_find(root->outputs, output); + if (!sway_assert(index >= 0, "Output not found in root node")) { + return; + } + sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name); wl_signal_emit(&output->events.destroy, output); @@ -258,7 +263,6 @@ void output_disable(struct sway_output *output) { root_for_each_container(untrack_output, output); - int index = list_find(root->outputs, output); list_del(root->outputs, index); output->enabled = false; From 28bcb1e6f259fc6b73faa7f32105779de1d4b4b2 Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Sun, 12 Jul 2020 19:53:16 -0700 Subject: [PATCH 14/21] xdg_shell: schedule configure on maximize requests (cherry picked from commit 4dd46f06acc520449b980a5ea52be544cc5bfb6d) --- sway/desktop/xdg_shell.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index df751ef6f..b9f398337 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -360,6 +360,11 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) transaction_commit_dirty(); } +static void handle_request_maximize(struct wl_listener *listener, void *data) { + struct wlr_xdg_surface *surface = data; + wlr_xdg_surface_schedule_configure(surface); +} + static void handle_request_move(struct wl_listener *listener, void *data) { struct sway_xdg_shell_view *xdg_shell_view = wl_container_of(listener, xdg_shell_view, request_move); @@ -402,6 +407,7 @@ static void handle_unmap(struct wl_listener *listener, void *data) { wl_list_remove(&xdg_shell_view->commit.link); wl_list_remove(&xdg_shell_view->new_popup.link); wl_list_remove(&xdg_shell_view->request_fullscreen.link); + wl_list_remove(&xdg_shell_view->request_maximize.link); wl_list_remove(&xdg_shell_view->request_move.link); wl_list_remove(&xdg_shell_view->request_resize.link); wl_list_remove(&xdg_shell_view->set_title.link); @@ -450,6 +456,10 @@ static void handle_map(struct wl_listener *listener, void *data) { wl_signal_add(&xdg_surface->toplevel->events.request_fullscreen, &xdg_shell_view->request_fullscreen); + xdg_shell_view->request_maximize.notify = handle_request_maximize; + wl_signal_add(&xdg_surface->toplevel->events.request_maximize, + &xdg_shell_view->request_maximize); + xdg_shell_view->request_move.notify = handle_request_move; wl_signal_add(&xdg_surface->toplevel->events.request_move, &xdg_shell_view->request_move); From 105c69d431389aecb908cccfce3712f77251ccde Mon Sep 17 00:00:00 2001 From: Campbell Vertesi Date: Mon, 13 Jul 2020 16:47:20 +0200 Subject: [PATCH 15/21] Add note on quoting to swaymsg manpage (cherry picked from commit acbe9028157c67eb3937299ff86e5ee26816a408) --- swaymsg/swaymsg.1.scd | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/swaymsg/swaymsg.1.scd b/swaymsg/swaymsg.1.scd index b8a38b544..4228a0f00 100644 --- a/swaymsg/swaymsg.1.scd +++ b/swaymsg/swaymsg.1.scd @@ -44,12 +44,18 @@ _swaymsg_ [options...] [message] The message is a sway command (the same commands you can bind to keybindings in your sway config file). It will be executed immediately. - See **sway**(5) for a list of commands. + See *sway*(5) for a list of commands. - Tip: If you are proving a command that contains a leading hyphen (_-_), - insert two hyphens (_--_) before the command to signal to swaymsg not to - parse anything beyond that point as an option. For example, use - _swaymsg -- mark --add test_ instead of _swaymsg mark --add test_ + Tips: + - Command expansion is performed twice: once by swaymsg, and again by sway. + If you have quoted multi-word strings in your command, enclose the entire + command in single-quotes. For example, use + _swaymsg 'output "Foobar Display" enable'_ instead of + _swaymsg output "Foobar Display" enable_. + - If you are proving a command that contains a leading hyphen (_-_), insert + two hyphens (_--_) before the command to signal to swaymsg not to parse + anything beyond that point as an option. For example, use + _swaymsg -- mark --add test_ instead of _swaymsg mark --add test_. *get\_workspaces* Gets a JSON-encoded list of workspaces and their status. From a314deeaa3f5521a5ceae631682c953b6d2c9d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vinko=20Ka=C5=A1ljevi=C4=87?= Date: Wed, 15 Jul 2020 18:31:09 +0200 Subject: [PATCH 16/21] Add check for empty GEOM variable In case when slurp is used to select part of screen or a window, if user aborts the selection, grimshot will capture the whole screen instead of exiting. This is fixed with check for empty variable. (cherry picked from commit c65cd1cffa5a791202ee913afef40dffdc54e5bc) --- contrib/grimshot | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/grimshot b/contrib/grimshot index 4ee8d902c..461a5eeff 100755 --- a/contrib/grimshot +++ b/contrib/grimshot @@ -111,6 +111,10 @@ if [ "$ACTION" = "check" ] ; then exit elif [ "$SUBJECT" = "area" ] ; then GEOM=$(slurp -d) + # Check if user exited slurp without selecting the area + if [ -z "$GEOM" ]; then + exit + fi WHAT="Area" elif [ "$SUBJECT" = "active" ] ; then FOCUSED=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)') @@ -126,6 +130,10 @@ elif [ "$SUBJECT" = "output" ] ; then WHAT="$OUTPUT" elif [ "$SUBJECT" = "window" ] ; then GEOM=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp) + # Check if user exited slurp without selecting the area + if [ -z "$GEOM" ]; then + exit + fi WHAT="Window" else die "Unknown subject to take a screen shot from" "$SUBJECT" From e79e89c94d20792c122ec5e173808307c7b579f2 Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Sun, 7 Jun 2020 16:43:53 -0400 Subject: [PATCH 17/21] input/cursor: don't send wl_pointer.motion event on pointer unlock warp On warping to a cursor hint, update the pointer position we track as well, so that on the next pointer rebase we don't send an unexpected synthetic motion event to clients. Fixes #5405. (cherry picked from commit 6b9a9b62462c0fae7b09294700112c569a3ccc19) --- sway/input/cursor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 0d5b076b0..e43a0e719 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -1244,6 +1244,10 @@ static void warp_to_constraint_cursor_hint(struct sway_cursor *cursor) { double ly = sy + con->content_y - view->geometry.y; wlr_cursor_warp(cursor->cursor, NULL, lx, ly); + + // Warp the pointer as well, so that on the next pointer rebase we don't + // send an unexpected synthetic motion event to clients. + wlr_seat_pointer_warp(constraint->seat, sx, sy); } } From 8ee58a3ad06403fbc985a44ac3c7c29488e3f07a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 16 Jul 2020 00:59:25 +0200 Subject: [PATCH 18/21] Bump wlroots dependency to 0.11.0 (cherry picked from commit 9f944ff05d8ba86c11f3d694120bf0c960e57905) --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 997110601..efb05ab64 100644 --- a/meson.build +++ b/meson.build @@ -60,7 +60,7 @@ math = cc.find_library('m') rt = cc.find_library('rt') # Try first to find wlroots as a subproject, then as a system dependency -wlroots_version = ['>=0.10.0', '<0.11.0'] +wlroots_version = ['>=0.11.0', '<0.12.0'] wlroots_proj = subproject( 'wlroots', default_options: ['examples=false'], From 108b8e97b77acba6206cdc69e419531d17380c7a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 16 Jul 2020 00:59:41 +0200 Subject: [PATCH 19/21] Bump version to 1.5 --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index efb05ab64..0e4f4ccff 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'sway', 'c', - version: 'v1.5-rc2', #release_version + version: 'v1.5', #release_version license: 'MIT', meson_version: '>=0.53.0', default_options: [ From 3cb59e31ca841b9c2048b83ab44786d2d3b8cf22 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 8 Nov 2020 15:15:15 +0100 Subject: [PATCH 20/21] build: bump wlroots dependency to 0.12.0 (cherry picked from commit 5ae4f65045c04df7ad2d87142b4064803d97a73e) --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 0e4f4ccff..f1e32cac1 100644 --- a/meson.build +++ b/meson.build @@ -60,7 +60,7 @@ math = cc.find_library('m') rt = cc.find_library('rt') # Try first to find wlroots as a subproject, then as a system dependency -wlroots_version = ['>=0.11.0', '<0.12.0'] +wlroots_version = ['>=0.12.0', '<0.13.0'] wlroots_proj = subproject( 'wlroots', default_options: ['examples=false'], From eca57594a04ed5e6f2294bb51ce29445849cc48b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 10 Nov 2020 17:47:31 +0100 Subject: [PATCH 21/21] build: bump version to 1.5.1 --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index f1e32cac1..00d39c988 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'sway', 'c', - version: 'v1.5', #release_version + version: '1.5.1', #release_version license: 'MIT', meson_version: '>=0.53.0', default_options: [