Merge branch 'master' into floating-fix

This commit is contained in:
carpetoctopus 2026-05-29 20:12:49 +02:00 committed by GitHub
commit ad3ed6abef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 40 additions and 27 deletions

View file

@ -57,7 +57,7 @@ Si vous utilisez déjà i3, copiez votre configuration i3 vers
`~/.config/sway/config` et sway fonctionnera directement. Sinon, copiez `~/.config/sway/config` et sway fonctionnera directement. Sinon, copiez
l'exemple de fichier de configuration vers `~/.config/sway/config`. Il se l'exemple de fichier de configuration vers `~/.config/sway/config`. Il se
trouve généralement dans `/etc/sway/config`. Exécutez `man 5 sway` pour lire la trouve généralement dans `/etc/sway/config`. Exécutez `man 5 sway` pour lire la
documentation pour la configuration de sway. documentation sur la configuration de sway.
## Exécution ## Exécution

View file

@ -1133,8 +1133,6 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
return; return;
} }
struct sway_workspace *last_workspace = seat_get_focused_workspace(seat);
if (node == NULL) { if (node == NULL) {
seat_send_unfocus(last_focus, seat); seat_send_unfocus(last_focus, seat);
sway_input_method_relay_set_focus(&seat->im_relay, NULL); sway_input_method_relay_set_focus(&seat->im_relay, NULL);
@ -1157,17 +1155,15 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
return; return;
} }
// Find the output's last workspace, which might have to be removed if empty
struct sway_output *new_output = struct sway_output *new_output =
new_workspace ? new_workspace->output : NULL; new_workspace ? new_workspace->output : NULL;
struct sway_workspace *last_workspace =
new_output ? output_get_active_workspace(new_output) : NULL;
if (last_workspace != new_workspace && new_output) { if (last_workspace != new_workspace && new_output) {
node_set_dirty(&new_output->node); node_set_dirty(&new_output->node);
} }
// find new output's old workspace, which might have to be removed if empty
struct sway_workspace *new_output_last_ws =
new_output ? output_get_active_workspace(new_output) : NULL;
// Unfocus the previous focus // Unfocus the previous focus
if (last_focus) { if (last_focus) {
seat_send_unfocus(last_focus, seat); seat_send_unfocus(last_focus, seat);
@ -1211,11 +1207,11 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
} }
// Move sticky containers to new workspace // Move sticky containers to new workspace
if (new_workspace && new_output_last_ws if (new_workspace && last_workspace
&& new_workspace != new_output_last_ws) { && new_workspace != last_workspace) {
for (int i = 0; i < new_output_last_ws->floating->length; ++i) { for (int i = 0; i < last_workspace->floating->length; ++i) {
struct sway_container *floater = struct sway_container *floater =
new_output_last_ws->floating->items[i]; last_workspace->floating->items[i];
if (container_is_sticky(floater)) { if (container_is_sticky(floater)) {
container_detach(floater); container_detach(floater);
workspace_add_floating(new_workspace, floater); workspace_add_floating(new_workspace, floater);
@ -1244,13 +1240,9 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n
} }
} }
if (new_output_last_ws) { if (last_workspace) {
workspace_consider_destroy(new_output_last_ws);
}
if (last_workspace && last_workspace != new_output_last_ws) {
workspace_consider_destroy(last_workspace); workspace_consider_destroy(last_workspace);
} }
seat->has_focus = true; seat->has_focus = true;
if (config->smart_gaps && new_workspace) { if (config->smart_gaps && new_workspace) {

View file

@ -234,26 +234,31 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
if (layout == L_HORIZ || layout == L_TABBED) { if (layout == L_HORIZ || layout == L_TABBED) {
if (cursor->cursor->y < thresh_top) { if (cursor->cursor->y < thresh_top) {
edge = WLR_EDGE_TOP; edge = WLR_EDGE_TOP;
if (thresh_top < box.y) thresh_top = box.y;
box.height = thresh_top - box.y; box.height = thresh_top - box.y;
} else if (cursor->cursor->y > thresh_bottom) { } else if (cursor->cursor->y > thresh_bottom) {
edge = WLR_EDGE_BOTTOM; edge = WLR_EDGE_BOTTOM;
if (thresh_bottom > box.y + box.height) thresh_bottom = box.y + box.height;
box.height = box.y + box.height - thresh_bottom; box.height = box.y + box.height - thresh_bottom;
box.y = thresh_bottom; box.y = thresh_bottom;
} }
} else if (layout == L_VERT || layout == L_STACKED) { } else if (layout == L_VERT || layout == L_STACKED) {
if (cursor->cursor->x < thresh_left) { if (cursor->cursor->x < thresh_left) {
edge = WLR_EDGE_LEFT; edge = WLR_EDGE_LEFT;
if (thresh_left < box.x) thresh_left = box.x;
box.width = thresh_left - box.x; box.width = thresh_left - box.x;
} else if (cursor->cursor->x > thresh_right) { } else if (cursor->cursor->x > thresh_right) {
edge = WLR_EDGE_RIGHT; edge = WLR_EDGE_RIGHT;
if (thresh_right > box.x + box.width) thresh_right = box.x + box.width;
box.width = box.x + box.width - thresh_right; box.width = box.x + box.width - thresh_right;
box.x = thresh_right; box.x = thresh_right;
} }
} }
if (edge) { if (edge) {
e->target_node = node_get_parent(&con->node); e->target_node = node_get_parent(&con->node);
if (e->target_node == &e->con->node) { if (e->target_node && (e->target_node == &e->con->node ||
e->target_node = node_get_parent(e->target_node); node_has_ancestor(e->target_node, &e->con->node))) {
e->target_node = node_get_parent(&e->con->node);
} }
e->target_edge = edge; e->target_edge = edge;
update_indicator(e, &box); update_indicator(e, &box);

View file

@ -154,7 +154,7 @@ The following commands may only be used in the configuration file.
*input* <identifier> drag_lock enabled|disabled|enabled_sticky *input* <identifier> drag_lock enabled|disabled|enabled_sticky
Enables or disables drag lock for specified input device. The default is Enables or disables drag lock for specified input device. The default is
_enabled_sticky_. _disabled_.
*input* <identifier> dwt enabled|disabled *input* <identifier> dwt enabled|disabled
Enables or disables disable-while-typing for the specified input device. Enables or disables disable-while-typing for the specified input device.

View file

@ -920,7 +920,7 @@ void workspace_unwrap_children(struct sway_workspace *ws,
while (wrap->pending.children->length) { while (wrap->pending.children->length) {
struct sway_container *child = wrap->pending.children->items[0]; struct sway_container *child = wrap->pending.children->items[0];
container_detach(child); container_detach(child);
workspace_add_tiling(ws, child); workspace_insert_tiling_direct(ws, child, ws->tiling->length);
} }
} }

View file

@ -417,6 +417,28 @@ void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind) {
} }
bool ipc_initialize(struct swaybar *bar) { bool ipc_initialize(struct swaybar *bar) {
if (!bar->id) {
uint32_t len = 0;
char *res = ipc_single_command(bar->ipc_socketfd,
IPC_GET_BAR_CONFIG, "", &len);
json_object *bars = json_tokener_parse(res);
if (!json_object_is_type(bars, json_type_array)
|| json_object_array_length(bars) == 0) {
sway_log(SWAY_ERROR, "No bar configuration found, "
"please configure a bar block in your sway config file.");
json_object_put(bars);
free(res);
return false;
}
json_object *first = json_object_array_get_idx(bars, 0);
bar->id = strdup(json_object_get_string(first));
json_object_put(bars);
free(res);
sway_log(SWAY_INFO, "Using first bar config: %s. "
"Use --bar_id to manually select a different bar configuration.",
bar->id);
}
uint32_t len = strlen(bar->id); uint32_t len = strlen(bar->id);
char *res = ipc_single_command(bar->ipc_socketfd, char *res = ipc_single_command(bar->ipc_socketfd,
IPC_GET_BAR_CONFIG, bar->id, &len); IPC_GET_BAR_CONFIG, bar->id, &len);

View file

@ -72,12 +72,6 @@ int main(int argc, char **argv) {
sway_log_init(SWAY_INFO, NULL); sway_log_init(SWAY_INFO, NULL);
} }
if (!swaybar.id) {
sway_log(SWAY_ERROR, "No bar_id passed. "
"Provide --bar_id or let sway start swaybar");
return 1;
}
if (!socket_path) { if (!socket_path) {
socket_path = get_socketpath(); socket_path = get_socketpath();
if (!socket_path) { if (!socket_path) {