Initial support for workspace pinning and moving

Adds support for cosmic-workspace-v2 pin, unpin, move_after, and
move_before requests.

Both features need some work with workspaces span displays mode, so that
will need more fixes later.

We also want to generate a unique id for pinned workspaces to send in
the ext-workspace-v1 protocol. But that isn't a strict requirement for
anything. So I haven't yet fully implemented that. We'll also want to
persist other things, like workspace naming when that's added.

Overall, though, with separate workspaces per display, this is working
pretty well.
This commit is contained in:
Ian Douglas Scott 2025-01-31 14:13:33 -08:00 committed by Victoria Brekenfeld
parent d1f4e7b12d
commit 96e9bf3b81
14 changed files with 622 additions and 118 deletions

View file

@ -20,7 +20,7 @@ use smithay::{
use std::{collections::HashSet, sync::Mutex};
use super::{
Request, Workspace, WorkspaceCapabilities, WorkspaceGlobalData, WorkspaceGroup,
Request, State, Workspace, WorkspaceCapabilities, WorkspaceGlobalData, WorkspaceGroup,
WorkspaceGroupHandle, WorkspaceHandler, WorkspaceState,
};
@ -469,12 +469,23 @@ where
changed = true;
}
if handle_state.states != Some(workspace.states) {
instance.state(workspace.states);
handle_state.states = Some(workspace.states.clone());
let states = workspace
.states
.iter()
.filter_map(|state| match state {
State::Active => Some(ext_workspace_handle_v1::State::Active),
State::Urgent => Some(ext_workspace_handle_v1::State::Urgent),
State::Hidden => Some(ext_workspace_handle_v1::State::Hidden),
_ => None,
})
.collect();
if handle_state.states != Some(states) {
instance.state(states);
handle_state.states = Some(states);
changed = true;
}
// TODO ext_workspace_handle_v1::id
// TODO send id if pinned
if let Some(cosmic_v2_handle) = handle_state
.cosmic_v2_handle