Add vault window commands

Add commands for open and toggle vault
This commit is contained in:
Llewllyn 2024-05-03 19:25:28 +12:00 committed by GitHub
parent cc0baa3226
commit 20a14c9856
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

12
main.js
View File

@ -20,6 +20,8 @@ const LOG_PREFIX = "obsidian-tray",
ACTION_HIDE = "Hide Vault",
ACTION_RELAUNCH = "Relaunch Obsidian",
ACTION_CLOSE = "Close Vault",
ACTION_OPEN = "Open Vault",
ACTION_TOGGLE = "Toggle Vault Window"
DEFAULT_DATE_FORMAT = "YYYY-MM-DD",
ACCELERATOR_FORMAT = `
This hotkey is registered globally and will be detected even if Obsidian does
@ -473,6 +475,16 @@ class TrayPlugin extends obsidian.Plugin {
name: ACTION_CLOSE,
callback: closeVault,
});
this.addCommand({
id: "open-vault",
name: ACTION_OPEN,
callback: showWindows,
});
this.addCommand({
id: "toggle-vault",
name: ACTION_TOGGLE,
callback: toggleWindows,
});
}
onunload() {
cleanup();