feat: allow naming pinned workspaces
This commit is contained in:
parent
8f5f7c897d
commit
db0b1afeb5
3 changed files with 19 additions and 3 deletions
|
|
@ -439,6 +439,11 @@ fn create_workspace_from_pinned(
|
|||
| WorkspaceCapabilities::Pin
|
||||
| WorkspaceCapabilities::Move,
|
||||
);
|
||||
|
||||
if let Some(ref name) = pinned.name {
|
||||
state.set_workspace_name(&workspace_handle, name);
|
||||
}
|
||||
|
||||
Workspace::from_pinned(
|
||||
pinned,
|
||||
workspace_handle,
|
||||
|
|
@ -619,6 +624,7 @@ impl WorkspaceSet {
|
|||
state,
|
||||
self.workspaces.len() as u8 + 1,
|
||||
&workspace.handle,
|
||||
workspace.name.as_deref(),
|
||||
// this method is only used by code paths related to dynamic workspaces, so this should be fine
|
||||
);
|
||||
self.workspaces.push(workspace);
|
||||
|
|
@ -680,7 +686,12 @@ impl WorkspaceSet {
|
|||
|
||||
fn update_workspace_idxs(&self, state: &mut WorkspaceUpdateGuard<'_, State>) {
|
||||
for (i, workspace) in self.workspaces.iter().enumerate() {
|
||||
workspace_set_idx(state, i as u8 + 1, &workspace.handle);
|
||||
workspace_set_idx(
|
||||
state,
|
||||
i as u8 + 1,
|
||||
&workspace.handle,
|
||||
workspace.name.as_deref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5025,8 +5036,9 @@ fn workspace_set_idx(
|
|||
state: &mut WorkspaceUpdateGuard<'_, State>,
|
||||
idx: u8,
|
||||
handle: &WorkspaceHandle,
|
||||
name: Option<&str>,
|
||||
) {
|
||||
state.set_workspace_name(handle, format!("{}", idx));
|
||||
state.set_workspace_name(handle, name.unwrap_or(&format!("{}", idx)));
|
||||
state.set_workspace_coordinates(handle, &[idx as u32]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue