diff options
-rw-r--r-- | completions/fish/swayidle.fish | 3 | ||||
-rw-r--r-- | completions/fish/swaylock.fish | 38 | ||||
-rw-r--r-- | completions/fish/swaynag.fish | 29 | ||||
-rw-r--r-- | include/sway/output.h | 2 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | sway/desktop/output.c | 13 | ||||
-rw-r--r-- | sway/desktop/render.c | 7 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 4 | ||||
-rw-r--r-- | sway/input/seat.c | 6 | ||||
-rw-r--r-- | sway/tree/container.c | 5 | ||||
-rw-r--r-- | sway/tree/view.c | 22 | ||||
-rw-r--r-- | sway/tree/workspace.c | 10 | ||||
-rw-r--r-- | swaylock/swaylock.1.scd | 26 |
13 files changed, 132 insertions, 35 deletions
diff --git a/completions/fish/swayidle.fish b/completions/fish/swayidle.fish new file mode 100644 index 00000000..71279925 --- /dev/null +++ b/completions/fish/swayidle.fish @@ -0,0 +1,3 @@ +# swayidle +complete -c swayidle -s h --description 'show help' +complete -c swayidle -s d --description 'debug' diff --git a/completions/fish/swaylock.fish b/completions/fish/swaylock.fish index 965a22d2..99dff48f 100644 --- a/completions/fish/swaylock.fish +++ b/completions/fish/swaylock.fish @@ -1,11 +1,39 @@ # swaylock(1) completion +complete -c swaylock -s C -l config --description 'The config file to use. Default: $HOME/.swaylock/config, $XDG_CONFIG_HOME/swaylock/config, and SYSCONFDIR/swaylock/config.' complete -c swaylock -s h -l help --description "Show help message and quit." -complete -c swaylock -s c -l color --description "Turn the screen into the given color. If -i is used, this sets the background of the image into the given color. Defaults to white (ffffff), or transparent (00000000) if an image is in use." complete -c swaylock -s f -l daemonize --description "Fork into the background after spawning. Note: this is the default bahavior of i3lock." +complete -c swaylock -s v -l version --description "Show the version number and quit." +complete -c swaylock -s s -l socket --description "Use the specified socket path. Otherwise, swaymsg will as sway where the socket is (which is the value of $SWAYSOCK, then of $I350CK)." +complete -c swaylock -s e -l ignore-empty-password --description 'When an empty password is provided by the user, do not validate it.' + +# Appearance +complete -c swaylock -s u -l no-unlock-indicator --description "Disable the unlock indicator." complete -c swaylock -s i -l image --description "Display the given image, optionally on the given output. Use -c to set a background color." -complete -c swaylock -l scaling --description "Scaling mode for images: stretch, fill, fit, center, or tile." +complete -c swaylock -s s -l scaling --description "Scaling mode for images: stretch, fill, fit, center, or tile." complete -c swaylock -s t -l tiling --description "Same as --scaling=tile." -complete -c swaylock -s u -l no-unlock-indicator --description "Disable the unlock indicator." -complete -c swaylock -s v -l version --description "Show the version number and quit." -complete -c swaylock -l socket --description "Use the specified socket path. Othherwise, swaymsg will as sway where the socket is (which is the value of $SWAYSOCK, then of $I350CK)." +complete -c swaylock -s c -l color --description "Turn the screen into the given color. If -i is used, this sets the background of the image into the given color. Defaults to white (ffffff), or transparent (00000000) if an image is in use." +complete -c swaylock -l bs-hl-color --description 'Sets the color of backspace highlight segments.' +complete -c swaylock -l font --description 'Sets the font of the text inside the indicator.' +complete -c swaylock -l indicator-radius --description 'Sets the radius of the indicator to radius pixels. Default: 50' +complete -c swaylock -l indicator-thickness --description 'Sets the thickness of the indicator to thickness pixels. Default: 10' +complete -c swaylock -l inside-color --description 'Sets the color of the inside of the indicator when typing or idle.' +complete -c swaylock -l inside-clear-color --description 'Sets the color of the inside of the indicator when cleared.' +complete -c swaylock -l inside-ver-color --description 'Sets the color of the inside of the indicator when verifying.' +complete -c swaylock -l inside-wrong-color --description 'Sets the color of the inside of the indicator when invalid.' +complete -c swaylock -l key-hl-color --description 'Sets the color of key press highlight segments.' +complete -c swaylock -l line-color --description 'Sets the color of the lines that separate the inside and outside of the indicator when typing or idle.' +complete -c swaylock -l line-clear-color --description 'Sets the color of the lines that separate the inside and outside of the indicator when cleared.' +complete -c swaylock -l line-ver-color --description 'Sets the color of the lines that separate the inside and outside of the indicator when verifying.' +complete -c swaylock -l line-wrong-color --description 'Sets the color of the lines that separate the inside and outside of the indicator when invalid.' +complete -c swaylock -s n -l line-uses-inside --description 'Use the color of the inside of the indicator for the line separating the inside and outside of the indicator.' +complete -c swaylock -s r -l line-uses-ring --description 'Use the outer ring\'s color for the line separating the inside and outside of the indicator.' +complete -c swaylock -l ring-color --description 'Sets the color of the outside of the indicator when typing or idle.' +complete -c swaylock -l ring-clear-color --description 'Sets the color of the outside of the indicator when cleared.' +complete -c swaylock -l ring-ver-color --description 'Sets the color of the outside of the indicator when verifying.' +complete -c swaylock -l ring-wrong-color --description 'Sets the color of the outside of the indicator when invalid.' +complete -c swaylock -l separator-color --description 'Sets the color of the lines that separate highlight segments.' +complete -c swaylock -l text-color --description 'Sets the color of the text inside the indicator when typing or idle.' +complete -c swaylock -l text-clear-color --description 'Sets the color of the text inside the indicator when cleared.' +complete -c swaylock -l text-ver-color --description 'Sets the color of the text inside the indicator when verifying.' +complete -c swaylock -l text-wrong-color --description 'Sets the color of the text inside the indicator when invalid.' diff --git a/completions/fish/swaynag.fish b/completions/fish/swaynag.fish new file mode 100644 index 00000000..784d7fad --- /dev/null +++ b/completions/fish/swaynag.fish @@ -0,0 +1,29 @@ +# swaynag +complete -c swaynag -s C -l config --description 'The config file to use. Default: $HOME/.swaylock/config, $XDG_CONFIG_HOME/swaylock/config, and SYSCONFDIR/swaylock/config.' +complete -c swaynag -s d -l debug --description 'Enable debugging.' +complete -c swaynag -s e -l edge --description 'Set the edge to use: top or bottom' +complete -c swaynag -s f -l font --description 'Set the font to use.' +complete -c swaynag -s h -l help --description 'Show help message and quit.' +complete -c swaynag -s b -l button --description 'Create a button with a text and an action which is executed when pressed. Multiple buttons can be defined by providing the flag multiple times.' +complete -c swaynag -s l -l detailed-message --description 'Read a detailed message from stdin. A button to toggle details will be added. Details are shown in a scrollable multi-line text area.' +complete -c swaynag -s L -l detailed-button --description 'Set the text for the button that toggles details. This has no effect if there is not a detailed message. The default is "Toggle details".' +complete -c swaynag -s m -l message --description 'Set the message text.' +complete -c swaynag -s o -l output --description 'Set the output to use.' +complete -c swaynag -s s -l dismiss-button --description 'Sets the text for the dismiss nagbar button. The default is "X".' +complete -c swaynag -s t -l type --description 'Set the message type. Two types are created by default "error" and "warning". Custom types can be defined in the config file.' +complete -c swaynag -s v -l version --description 'Show the version number and quit.' + +# Appearance +complete -c swaynag -l background --description 'Set the color of the background.' +complete -c swaynag -l border --description 'Set the color of the border.' +complete -c swaynag -l border-bottom --description 'Set the color of the bottom border.' +complete -c swaynag -l button-background --description 'Set the color for the background for buttons.' +complete -c swaynag -l text --description 'Set the text color.' +complete -c swaynag -l border-bottom-size --description 'Set the thickness of the bottom border.' +complete -c swaynag -l message-padding --description 'Set the padding for the message.' +complete -c swaynag -l details-border-size --description 'Set the thickness for the details border.' +complete -c swaynag -l button-border-size --description 'Set the thickness for the button border.' +complete -c swaynag -l button-gap --description 'Set the size of the gap between buttons.' +complete -c swaynag -l button-dismiss-gap --description 'Set the size of the gap between the dismiss button and another button.' +complete -c swaynag -l button-margin-right --description 'Set the margin from the right of the dismiss button to edge.' +complete -c swaynag -l button-padding --description 'Set the padding for the button text.' 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/meson.build b/meson.build index 1e2b53fa..6b23b4e3 100644 --- a/meson.build +++ b/meson.build @@ -244,8 +244,10 @@ endif if (get_option('fish-completions')) fish_files = files( 'completions/fish/sway.fish', + 'completions/fish/swayidle.fish', 'completions/fish/swaylock.fish', 'completions/fish/swaymsg.fish', + 'completions/fish/swaynag.fish', ) fish_install_dir = datadir + '/fish/completions' 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/desktop/render.c b/sway/desktop/render.c index 1a72f752..c1fa0c8c 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -781,6 +781,13 @@ static void render_containers_stacked(struct sway_output *output, static void render_containers(struct sway_output *output, pixman_region32_t *damage, struct parent_data *parent) { + if (parent->children->length == 1) { + struct sway_container *child = parent->children->items[0]; + if (child->view) { + render_containers_linear(output, damage, parent); + return; + } + } switch (parent->layout) { case L_NONE: case L_HORIZ: diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 955b05d6..c3efb210 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -301,7 +301,9 @@ static void transaction_apply(struct sway_transaction *transaction) { if (root->outputs->length) { struct sway_seat *seat; wl_list_for_each(seat, &server.input->seats, link) { - cursor_rebase(seat->cursor); + if (seat->operation == OP_NONE) { + cursor_rebase(seat->cursor); + } } } } diff --git a/sway/input/seat.c b/sway/input/seat.c index 577619a7..64419afa 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -185,7 +185,11 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) { seat_set_focus(seat, next_focus); } else { // Setting focus_inactive + focus = seat_get_focus_inactive(seat, &root->node); seat_set_raw_focus(seat, next_focus); + if (focus->type == N_CONTAINER) { + seat_set_raw_focus(seat, &focus->sway_container->workspace->node); + } seat_set_raw_focus(seat, focus); } } @@ -944,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/tree/container.c b/sway/tree/container.c index 58d3df34..8ab6ebf8 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -676,11 +676,8 @@ void container_set_floating(struct sway_container *container, bool enable) { container_detach(container); struct sway_container *reference = seat_get_focus_inactive_tiling(seat, workspace); - if (reference && reference->view) { - reference = reference->parent; - } if (reference) { - container_add_child(reference, container); + container_add_sibling(reference, container, 1); container->width = reference->width; container->height = reference->height; } else { diff --git a/sway/tree/view.c b/sway/tree/view.c index 4bc9e0f3..cf67acbb 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -242,23 +242,23 @@ void view_autoconfigure(struct sway_view *view) { view->border_bottom = bottom_y != ws->y + ws->height; } - double x, y, width, height; - x = y = width = height = 0; - double y_offset = 0; - // In a tabbed or stacked container, the container's y is the top of the // title area. We have to offset the surface y by the height of the title, // bar, and disable any top border because we'll always have the title bar. + double y_offset = 0; enum sway_container_layout layout = container_parent_layout(con); - if (layout == L_TABBED && !container_is_floating(con)) { - y_offset = container_titlebar_height(); - view->border_top = false; - } else if (layout == L_STACKED && !container_is_floating(con)) { - list_t *siblings = container_get_siblings(con); - y_offset = container_titlebar_height() * siblings->length; - view->border_top = false; + list_t *siblings = container_get_siblings(con); + if (siblings->length > 1 && !container_is_floating(con)) { + if (layout == L_TABBED) { + y_offset = container_titlebar_height(); + view->border_top = false; + } else if (layout == L_STACKED) { + y_offset = container_titlebar_height() * siblings->length; + view->border_top = false; + } } + double x = 0, y = 0, width = 0, height = 0; switch (view->border) { case B_CSD: case B_NONE: 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, diff --git a/swaylock/swaylock.1.scd b/swaylock/swaylock.1.scd index 3107124f..8ddc7d3a 100644 --- a/swaylock/swaylock.1.scd +++ b/swaylock/swaylock.1.scd @@ -21,20 +21,25 @@ Locks your Wayland session. All leading dashes should be omitted and the equals sign is required for flags that take an argument. -*-c, --color* <rrggbb[aa]> - Turn the screen into the given color. If -i is used, this sets the - background of the image to the given color. Defaults to white (FFFFFF), or - transparent (00000000) if an image is in use. - *-e, --ignore-empty-password* When an empty password is provided by the user, do not validate it. *-f, --daemonize* Detach from the controlling terminal after locking. + Note: this is the default bahavior of i3lock. + *-h, --help* Show help message and quit. +*-v, --version* + Show the version number and quit. + +# APPEARANCE + +*-u, --no-unlock-indicator* + Disable the unlock indicator. + *-i, --image* [<output>:]<path> Display the given image, optionally only on the given output. Use -c to set a background color. @@ -45,13 +50,10 @@ Locks your Wayland session. *-t, --tiling* Same as --scaling=tile. -*-u, --no-unlock-indicator* - Disable the unlock indicator. - -*-v, --version* - Show the version number and quit. - -# APPEARANCE +*-c, --color* <rrggbb[aa]> + Turn the screen into the given color. If -i is used, this sets the + background of the image to the given color. Defaults to white (FFFFFF), or + transparent (00000000) if an image is in use. *--bs-hl-color* <rrggbb[aa]> Sets the color of backspace highlight segments. |