diff --git a/config.in b/config.in index 67c748ba3..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 @@ -112,27 +111,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. # 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" diff --git a/include/sway/output.h b/include/sway/output.h index 64dac52e2..dc67332cc 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -37,7 +37,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; @@ -99,7 +99,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/meson.build b/meson.build index 997110601..00d39c988 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'sway', 'c', - version: 'v1.5-rc2', #release_version + version: '1.5.1', #release_version license: 'MIT', meson_version: '>=0.53.0', default_options: [ @@ -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.12.0', '<0.13.0'] wlroots_proj = subproject( 'wlroots', default_options: ['examples=false'], diff --git a/sway/config/output.c b/sway/config/output.c index ccf423a1a..26e4fd06a 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -401,17 +401,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); @@ -425,11 +416,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; } @@ -472,8 +470,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/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); diff --git a/sway/input/cursor.c b/sway/input/cursor.c index d10ba444b..e43a0e719 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; @@ -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); } } diff --git a/sway/tree/output.c b/sway/tree/output.c index 9a10c6a89..d600c5c31 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); @@ -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,11 +263,9 @@ 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; - output->configured = false; output->current_mode = NULL; arrange_root(); 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.