MCPcopy Create free account
hub / github.com/experdot/pointer / resolveDisplayPlatform

Function resolveDisplayPlatform

src/renderer/src/utils/shortcutPresentation.ts:24–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22}
23
24function resolveDisplayPlatform(): DisplayPlatform {
25 if (cachedDisplayPlatform) {
26 return cachedDisplayPlatform
27 }
28
29 if (typeof navigator === 'undefined') {
30 cachedDisplayPlatform = 'default'
31 return cachedDisplayPlatform
32 }
33
34 const navigatorWithUserAgentData = navigator as Navigator & {
35 userAgentData?: { platform?: string }
36 }
37 const platformHint = [
38 navigatorWithUserAgentData.userAgentData?.platform,
39 navigator.platform,
40 navigator.userAgent
41 ]
42 .filter(Boolean)
43 .join(' ')
44 .toLowerCase()
45
46 cachedDisplayPlatform = platformHint.includes('mac') ? 'darwin' : 'default'
47 return cachedDisplayPlatform
48}
49
50export function getShortcutLabel(id: ShortcutLabelId): string {
51 const modifier = resolveDisplayPlatform() === 'darwin' ? 'Cmd' : 'Ctrl'

Callers 1

getShortcutLabelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected