WorkspacesPluginInstance
Unofficial
Plugin instance for workspaces, managing saving and loading of workspace layouts.
Import:
import type { WorkspacesPluginInstance } from '@obsidian-typings/obsidian-public-latest';Signature:
export interface WorkspacesPluginInstance extends InternalPluginInstance<WorkspacesPlugin>Extends: InternalPluginInstance<WorkspacesPlugin>
Properties
| Property | Type | Description | |
|---|---|---|---|
| activeWorkspace | string | Name of the active workspace, or an empty string when none is active. | |
| app | App | Reference to the app. | |
| description | string | Human-readable description of this plugin. (Inherited from InternalPluginInstance) | |
| id | string | Unique identifier for this plugin. (Inherited from InternalPluginInstance) | |
| name | string | Human-readable display name of this plugin. (Inherited from InternalPluginInstance) | |
| plugin | WorkspacesPlugin | Reference to the workspaces plugin registration. | |
| workspaces | Record<string, Record<string, unknown>> | Saved workspaces, keyed by name. Each value is the result of app.workspace.getLayout() at the time of saving, plus an mtime string formatted by moment().format(). |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| deleteWorkspace(name) | Promise<void> | Delete a saved workspace and persist the plugin data. | |
| init(app, plugin) | void | Initialize the plugin instance with app and plugin references. (Inherited from InternalPluginInstance) | |
| loadWorkspace(name) | Promise<void> | Load a saved workspace: make it active, apply its layout through app.workspace.changeLayout() and persist the plugin data. Does nothing when no workspace has that name. | |
| onDisable(app, plugin) | Promise<void> | Called when the plugin is disabled; persists the plugin data. | |
| onDisable(app, plugin) | void | Called when the plugin is disabled. (Inherited from InternalPluginInstance) | |
| onEnable(app, plugin) | Promise<void> | Called when the plugin is enabled; loads the saved workspaces and registers the CLI handlers. | |
| onEnable(app, plugin) | Promise<void> | Called when the plugin is enabled. (Inherited from InternalPluginInstance) | |
| onLoad() | boolean | Callback of the workspaces:load command; opens the workspace load modal. | |
| onOpenModal() | void | Callback of the ribbon item and the workspaces:open-modal command; opens the workspace management modal. | |
| onSave() | void | Callback of the workspaces:save command; saves the active workspace, or opens the management modal when none is active. | |
| onSaveAndLoad() | boolean | Callback of the workspaces:save-and-load command; opens the workspace load modal that saves the active workspace first. | |
| onUserDisable(app) | void | Called when the user manually disables the plugin. (Inherited from InternalPluginInstance) | |
| onUserEnable(app) | void | Called when the user manually enables the plugin. (Inherited from InternalPluginInstance) | |
| saveData() | Promise<void> | Persist the saved workspaces and the active workspace name to the plugin data. | |
| saveWorkspace(name) | void | Save the current workspace layout under a name and persist the plugin data. | |
| setActiveWorkspace(name) | void | Set the active workspace name and persist the plugin data. |
Links to this page: