diff --git a/src/renderer/src/constants/shortcuts.ts b/src/renderer/src/constants/shortcuts.ts index 7ae7497a9..3edc3affd 100644 --- a/src/renderer/src/constants/shortcuts.ts +++ b/src/renderer/src/constants/shortcuts.ts @@ -20,6 +20,10 @@ export const shortcuts = { name: "Show/Hide Feed Sidebar", key: "Meta+B", }, + showShortcuts: { + name: "Show Shortcuts", + key: "H", + }, }, entries: { refetch: { diff --git a/src/renderer/src/pages/(main)/layout.tsx b/src/renderer/src/pages/(main)/layout.tsx index a822a0ebf..fbd4677a3 100644 --- a/src/renderer/src/pages/(main)/layout.tsx +++ b/src/renderer/src/pages/(main)/layout.tsx @@ -24,6 +24,7 @@ import { CornerPlayer } from "@renderer/modules/feed-column/corner-player" import { CmdF } from "@renderer/modules/panel/cmdf" import { SearchCmdK } from "@renderer/modules/panel/cmdk" import { CmdNTrigger } from "@renderer/modules/panel/cmdn" +import { useSettingModal } from "@renderer/modules/settings/modal/hooks" import { throttle } from "lodash-es" import type { PropsWithChildren } from "react" import React, { useEffect, useRef, useState } from "react" @@ -168,6 +169,16 @@ const FeedResponsiveResizerContainer = ({ scopes: HotKeyScopeMap.Home, }, ) + const settingModalPresent = useSettingModal() + useHotkeys( + shortcuts.layout.showShortcuts.key, + () => { + settingModalPresent("shortcuts") + }, + { + scopes: HotKeyScopeMap.Home, + }, + ) const [delayShowSplitter, setDelayShowSplitter] = useState(feedColumnShow) diff --git a/src/renderer/src/pages/settings/(settings)/shortcuts.tsx b/src/renderer/src/pages/settings/(settings)/shortcuts.tsx index d884ce869..b307a5507 100644 --- a/src/renderer/src/pages/settings/(settings)/shortcuts.tsx +++ b/src/renderer/src/pages/settings/(settings)/shortcuts.tsx @@ -1,4 +1,4 @@ -import { KbdCombined } from "@renderer/components/ui/kbd/Kbd" +import { Kbd, KbdCombined } from "@renderer/components/ui/kbd/Kbd" import { shortcuts } from "@renderer/constants/shortcuts" import { cn } from "@renderer/lib/utils" import { SettingsTitle } from "@renderer/modules/settings/title" @@ -17,6 +17,9 @@ export function Component() { return ( <> +

+ Press H to show this Shortcuts modal. +

{Object.keys(shortcuts).map((type) => (