feat(spaceshd): pinned workspace field
Add a `pinned` bool to the workspace model, threaded through proto (Workspace + WorkspaceView + SetWorkspaceMeta), the registry, the set_workspace_meta handler, persistence, the CLI mapping, and the Tauri bridge. serde(default) keeps existing state.json compatible (pinned=false). Backs the sidebar Favorites section. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -51,7 +51,7 @@ impl Registry {
|
||||
let order = self.workspaces.len() as u32;
|
||||
self.workspaces.insert(id.clone(), Workspace {
|
||||
id: id.clone(), path: key.clone(), name, group_id: None, order,
|
||||
unread: false, layout: None, zoomed: None, surfaces: HashMap::new(),
|
||||
unread: false, pinned: false, layout: None, zoomed: None, surfaces: HashMap::new(),
|
||||
});
|
||||
self.by_path.insert(key, id.clone());
|
||||
(id, true)
|
||||
@@ -168,7 +168,7 @@ impl Registry {
|
||||
}).collect();
|
||||
WorkspaceView {
|
||||
id: w.id.clone(), path: w.path.clone(), name: w.name.clone(),
|
||||
group_id: w.group_id.clone(), order: w.order, unread: w.unread,
|
||||
group_id: w.group_id.clone(), order: w.order, unread: w.unread, pinned: w.pinned,
|
||||
layout: w.layout.clone(), zoomed: w.zoomed.clone(), surfaces,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,12 +461,13 @@ async fn handle_request(
|
||||
let _ = out.send(ok(id, serde_json::Value::Null)).await;
|
||||
}
|
||||
|
||||
Cmd::SetWorkspaceMeta { workspace_id, name, group_id, unread, order } => {
|
||||
Cmd::SetWorkspaceMeta { workspace_id, name, group_id, unread, order, pinned } => {
|
||||
let found = reg.workspace_mut(&workspace_id).map(|w| {
|
||||
if let Some(n) = name { w.name = n; }
|
||||
if let Some(g) = group_id { w.group_id = g; }
|
||||
if let Some(u) = unread { w.unread = u; }
|
||||
if let Some(o) = order { w.order = o; }
|
||||
if let Some(p) = pinned { w.pinned = p; }
|
||||
}).is_some();
|
||||
if found {
|
||||
if let Some(view) = reg.workspace_view(&workspace_id) {
|
||||
|
||||
@@ -92,6 +92,7 @@ mod tests {
|
||||
group_id: None,
|
||||
order: 0,
|
||||
unread: false,
|
||||
pinned: false,
|
||||
layout: None,
|
||||
zoomed: None,
|
||||
surfaces: std::collections::HashMap::new(),
|
||||
|
||||
Reference in New Issue
Block a user