ext-workspace-v1: initial implementation

Maintain a 1:1 relationship between workspace groups and outputs, so
that moving a workspace across groups effectively moves it across
outputs.

ext_workspace_handle_v1::id is never emitted; sway has no concept of ids
or of stable vs temporary workspaces. Everything is ephemeral to the
current session.

ext_workspace_handle_v1::coordinates is never emitted; sway does not
organise workspaces into any sort of grid.

ext_workspace_handle_v1::assign is mostly untested, because no client
current implements this. Perhaps it's best to not-advertise the feature
for now?

Deactivating a workspace is a no-op. This functionality doesn't really
align with sway, although it could potentially be implemented to "switch
to previous workspace on this output" as a follow-up.

Removing a workspace is a no-op.

Implements: https://github.com/swaywm/sway/issues/8812
This commit is contained in:
Hugo Osvaldo Barrera 2026-03-12 01:09:47 +01:00 committed by Simon Ser
parent 7ba11d6dee
commit f50f78c0d9
8 changed files with 176 additions and 1 deletions

View file

@ -63,6 +63,7 @@ struct sway_output {
struct wl_listener request_state;
struct wlr_color_transform *color_transform;
struct wlr_ext_workspace_group_handle_v1 *ext_workspace_group;
struct timespec last_presentation;
uint32_t refresh_nsec;

View file

@ -127,6 +127,9 @@ struct sway_server {
struct wl_listener tearing_control_new_object;
struct wl_list tearing_controllers; // sway_tearing_controller::link
struct wlr_ext_workspace_manager_v1 *workspace_manager_v1;
struct wl_listener workspace_manager_v1_commit;
struct wl_list pending_launcher_ctxs; // launcher_ctx::link
// The timeout for transactions, after which a transaction is applied

View file

@ -3,6 +3,7 @@
#include <stdbool.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_ext_workspace_v1.h>
#include "sway/config.h"
#include "sway/tree/container.h"
#include "sway/tree/node.h"
@ -51,6 +52,7 @@ struct sway_workspace {
bool urgent;
struct sway_workspace_state current;
struct wlr_ext_workspace_handle_v1 *ext_workspace; // Always set.
};
struct workspace_config *workspace_find_config(const char *ws_name);
@ -160,4 +162,8 @@ void workspace_squash(struct sway_workspace *workspace);
void workspace_move_to_output(struct sway_workspace *workspace,
struct sway_output *output);
void sway_ext_workspace_init(void);
void sway_ext_workspace_output_enable(struct sway_output *output);
void sway_ext_workspace_output_disable(struct sway_output *output);
#endif