Skip to content

WorkspacesPluginInstance

Unofficial

Plugin instance for workspaces, managing saving and loading of workspace layouts.

Import:

import type { WorkspacesPluginInstance } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface WorkspacesPluginInstance extends InternalPluginInstance<WorkspacesPlugin>

Extends: InternalPluginInstance<WorkspacesPlugin>

Properties

PropertyTypeDescription
activeWorkspacestringName of the active workspace, or an empty string when none is active.
appAppReference to the app.
descriptionstringHuman-readable description of this plugin.
(Inherited from InternalPluginInstance)
idstringUnique identifier for this plugin.
(Inherited from InternalPluginInstance)
namestringHuman-readable display name of this plugin.
(Inherited from InternalPluginInstance)
pluginWorkspacesPluginReference to the workspaces plugin registration.
workspacesRecord<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

MethodReturnsDescription
deleteWorkspace(name)Promise<void>Delete a saved workspace and persist the plugin data.
init(app, plugin)voidInitialize 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)voidCalled 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()booleanCallback of the workspaces:load command; opens the workspace load modal.
onOpenModal()voidCallback of the ribbon item and the workspaces:open-modal command; opens the workspace management modal.
onSave()voidCallback of the workspaces:save command; saves the active workspace, or opens the management modal when none is active.
onSaveAndLoad()booleanCallback of the workspaces:save-and-load command; opens the workspace load modal that saves the active workspace first.
onUserDisable(app)voidCalled when the user manually disables the plugin.
(Inherited from InternalPluginInstance)
onUserEnable(app)voidCalled 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)voidSave the current workspace layout under a name and persist the plugin data.
setActiveWorkspace(name)voidSet the active workspace name and persist the plugin data.

Links to this page: