MCPcopy Create free account
hub / github.com/GCWing/BitFun / set_active_workspace

Function set_active_workspace

src/apps/desktop/src/api/commands.rs:1829–1861  ·  view source on GitHub ↗
(
    state: State<'_, AppState>,
    app: tauri::AppHandle,
    request: SetActiveWorkspaceRequest,
)

Source from the content-addressed store, hash-verified

1827
1828#[tauri::command]
1829pub async fn set_active_workspace(
1830 state: State<'_, AppState>,
1831 app: tauri::AppHandle,
1832 request: SetActiveWorkspaceRequest,
1833) -> Result<WorkspaceInfoDto, String> {
1834 match state
1835 .workspace_service
1836 .set_active_workspace(&request.workspace_id)
1837 .await
1838 {
1839 Ok(_) => {
1840 let workspace_info = state
1841 .workspace_service
1842 .get_current_workspace()
1843 .await
1844 .ok_or_else(|| "Active workspace not found after switching".to_string())?;
1845
1846 apply_active_workspace_context(&state, &app, &workspace_info, None).await;
1847
1848 info!(
1849 "Active workspace changed: workspace_id={}, path={}",
1850 workspace_info.id,
1851 workspace_info.root_path.display()
1852 );
1853
1854 Ok(WorkspaceInfoDto::from_workspace_info(&workspace_info))
1855 }
1856 Err(e) => {
1857 error!("Failed to set active workspace: {}", e);
1858 Err(format!("Failed to set active workspace: {}", e))
1859 }
1860 }
1861}
1862
1863#[tauri::command]
1864pub async fn reorder_opened_workspaces(

Callers

nothing calls this directly

Calls 3

set_active_workspaceMethod · 0.45
get_current_workspaceMethod · 0.45

Tested by

no test coverage detected