mirror of
https://github.com/swaywm/sway.git
synced 2025-11-24 06:59:51 -05:00
Merge branch 'master' into workspace-move-to-output
This commit is contained in:
commit
639f3368e1
19 changed files with 534 additions and 192 deletions
|
|
@ -843,7 +843,7 @@ struct sway_container *container_split(struct sway_container *child,
|
|||
}
|
||||
if (child->type == C_WORKSPACE && child->children->length == 0) {
|
||||
// Special case: this just behaves like splitt
|
||||
child->prev_layout = child->layout;
|
||||
child->prev_split_layout = child->layout;
|
||||
child->layout = layout;
|
||||
return child;
|
||||
}
|
||||
|
|
@ -854,7 +854,7 @@ struct sway_container *container_split(struct sway_container *child,
|
|||
|
||||
remove_gaps(child);
|
||||
|
||||
cont->prev_layout = L_NONE;
|
||||
cont->prev_split_layout = L_NONE;
|
||||
cont->width = child->width;
|
||||
cont->height = child->height;
|
||||
cont->x = child->x;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/types/wlr_buffer.h>
|
||||
|
|
@ -456,7 +457,13 @@ static struct sway_container *select_workspace(struct sway_view *view) {
|
|||
if (criteria->type == CT_ASSIGN_WORKSPACE) {
|
||||
ws = workspace_by_name(criteria->target);
|
||||
if (!ws) {
|
||||
ws = workspace_create(NULL, criteria->target);
|
||||
if (strcasecmp(criteria->target, "back_and_forth") == 0) {
|
||||
if (prev_workspace_name) {
|
||||
ws = workspace_create(NULL, prev_workspace_name);
|
||||
}
|
||||
} else {
|
||||
ws = workspace_create(NULL, criteria->target);
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
|
|
@ -891,6 +898,15 @@ static bool find_by_mark_iterator(struct sway_container *con,
|
|||
return con->type == C_VIEW && view_has_mark(con->sway_view, mark);
|
||||
}
|
||||
|
||||
struct sway_view *view_find_mark(char *mark) {
|
||||
struct sway_container *container = container_find(&root_container,
|
||||
find_by_mark_iterator, mark);
|
||||
if (!container) {
|
||||
return NULL;
|
||||
}
|
||||
return container->sway_view;
|
||||
}
|
||||
|
||||
bool view_find_and_unmark(char *mark) {
|
||||
struct sway_container *container = container_find(&root_container,
|
||||
find_by_mark_iterator, mark);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ struct sway_container *workspace_create(struct sway_container *output,
|
|||
workspace->width = output->width;
|
||||
workspace->height = output->height;
|
||||
workspace->name = !name ? NULL : strdup(name);
|
||||
workspace->prev_layout = L_NONE;
|
||||
workspace->prev_split_layout = L_NONE;
|
||||
workspace->layout = container_get_default_layout(output);
|
||||
|
||||
struct sway_workspace *swayws = calloc(1, sizeof(struct sway_workspace));
|
||||
|
|
@ -250,6 +250,7 @@ struct sway_container *workspace_by_name(const char *name) {
|
|||
current_workspace = container_parent(focus, C_WORKSPACE);
|
||||
current_output = container_parent(focus, C_OUTPUT);
|
||||
}
|
||||
|
||||
if (strcmp(name, "prev") == 0) {
|
||||
return workspace_prev(current_workspace);
|
||||
} else if (strcmp(name, "prev_on_output") == 0) {
|
||||
|
|
@ -260,6 +261,9 @@ struct sway_container *workspace_by_name(const char *name) {
|
|||
return workspace_output_next(current_output);
|
||||
} else if (strcmp(name, "current") == 0) {
|
||||
return current_workspace;
|
||||
} else if (strcasecmp(name, "back_and_forth") == 0) {
|
||||
return prev_workspace_name ? container_find(&root_container,
|
||||
_workspace_by_name, (void *)prev_workspace_name) : NULL;
|
||||
} else {
|
||||
return container_find(&root_container, _workspace_by_name,
|
||||
(void *)name);
|
||||
|
|
@ -364,7 +368,8 @@ struct sway_container *workspace_prev(struct sway_container *current) {
|
|||
return workspace_prev_next_impl(current, false);
|
||||
}
|
||||
|
||||
bool workspace_switch(struct sway_container *workspace) {
|
||||
bool workspace_switch(struct sway_container *workspace,
|
||||
bool no_auto_back_and_forth) {
|
||||
if (!workspace) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -379,7 +384,7 @@ bool workspace_switch(struct sway_container *workspace) {
|
|||
active_ws = container_parent(focus, C_WORKSPACE);
|
||||
}
|
||||
|
||||
if (config->auto_back_and_forth
|
||||
if (!no_auto_back_and_forth && config->auto_back_and_forth
|
||||
&& active_ws == workspace
|
||||
&& prev_workspace_name) {
|
||||
struct sway_container *new_ws = workspace_by_name(prev_workspace_name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue