Skip to content

Build your personal knowledge base with Trilium Notes

client/tab bar: add command palette integration

Adorian Doran58e2a37e35bd
diff --git a/apps/client/src/services/command_registry.ts b/apps/client/src/services/command_registry.ts
index 2e696d083f..62f32d6e55 100644
--- a/apps/client/src/services/command_registry.ts
+++ b/apps/client/src/services/command_registry.ts
@@ -95,6 +95,32 @@ export class CommandRegistry {
icon: "bx bx-sidebar",
handler: () => appContext.triggerCommand("showLaunchBarSubtree")
});
+
+ this.register({
+ id: "pin-active-tab",
+ name: t("command_palette.pin_tab_title"),
+ description: t("command_palette.pin_tab_description"),
+ icon: "bx bx-pin",
+ handler: () => {
+ const ntxId = appContext.tabManager.getActiveMainContext()?.ntxId;
+ if (ntxId) {
+ appContext.triggerCommand("pinTab", { ntxId });
+ }
+ }
+ });
+
+ this.register({
+ id: "unpin-active-tab",
+ name: t("command_palette.unpin_tab_title"),
+ description: t("command_palette.unpin_tab_description"),
+ icon: "bx bx-pin",
+ handler: () => {
+ const ntxId = appContext.tabManager.getActiveMainContext()?.ntxId;
+ if (ntxId) {
+ appContext.triggerCommand("unpinTab", { ntxId });
+ }
+ }
+ });
}
private async loadKeyboardActionsAsync() {
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index f0597c5fd6..6affd88383 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2358,7 +2358,11 @@
"search_history_title": "Show Search History",
"search_history_description": "View previous searches",
"configure_launch_bar_title": "Configure Launch Bar",
- "configure_launch_bar_description": "Open the launch bar configuration, to add or remove items."
+ "configure_launch_bar_description": "Open the launch bar configuration, to add or remove items.",
+ "pin_tab_title": "Pin Tab",
+ "pin_tab_description": "Always keep this note open in this tab at the start of the tab bar and prevent it from being accidentally closed",
+ "unpin_tab_title": "Unpin Tab",
+ "unpin_tab_description": "Unpin this tab, allowing it to be closed and moved freely"
},
"content_renderer": {
"open_externally": "Open externally"