From 5ba1d1a3f78910842092885a61fdacca16524601 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 7 Oct 2024 21:44:38 -0400 Subject: [PATCH] Show sidebar toggle keybinding shortcut on sidebar icon tooltip (#1160) --- src/components/sidebar/SideToolbar.vue | 11 ++++++++++- src/stores/workspace/sidebarTabStore.ts | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/sidebar/SideToolbar.vue b/src/components/sidebar/SideToolbar.vue index 476a7b706..62919dbc6 100644 --- a/src/components/sidebar/SideToolbar.vue +++ b/src/components/sidebar/SideToolbar.vue @@ -6,7 +6,7 @@ :key="tab.id" :icon="tab.icon" :iconBadge="tab.iconBadge" - :tooltip="tab.tooltip" + :tooltip="tab.tooltip + getTabTooltipSuffix(tab)" :selected="tab.id === selectedTab?.id" :class="tab.id + '-tab-button'" @click="onTabClick(tab)" @@ -45,6 +45,7 @@ import { CustomSidebarTabExtension, SidebarTabExtension } from '@/types/extensionTypes' +import { useKeybindingStore } from '@/stores/keybindingStore' const workspaceStore = useWorkspaceStore() const settingStore = useSettingStore() @@ -74,6 +75,14 @@ onBeforeUnmount(() => { } }) }) + +const keybindingStore = useKeybindingStore() +const getTabTooltipSuffix = (tab: SidebarTabExtension) => { + const keybinding = keybindingStore.getKeybindingByCommandId( + `Workspace.ToggleSidebarTab.${tab.id}` + ) + return keybinding ? ` (${keybinding.combo.toString()})` : '' +}