MCPcopy
hub / github.com/Kong/insomnia / displayModifierKey

Function displayModifierKey

packages/insomnia-data/common-src/hotkeys.ts:263–298  ·  view source on GitHub ↗
(key: keyof Omit<KeyCombination, 'keyCode'>)

Source from the content-addressed store, hash-verified

261}
262
263export const displayModifierKey = (key: keyof Omit<KeyCombination, 'keyCode'>) => {
264 const mac = isMac;
265 switch (key) {
266 case 'ctrl': {
267 return mac ? '⌃' : 'Ctrl';
268 }
269
270 case 'alt': {
271 return mac ? '⌥' : 'Alt';
272 }
273
274 case 'shift': {
275 return mac ? '⇧' : 'Shift';
276 }
277
278 case 'meta': {
279 if (mac) {
280 return '⌘';
281 }
282
283 if (isWindows) {
284 // Note: Although this unicode character for the Windows doesn't exist, the Unicode character U+229E ⊞ SQUARED PLUS is very commonly used for this purpose. For example, Wikipedia uses it as a simulation of the windows logo. Though, Windows itself uses `Windows` or `Win`, so we'll go with `Win` here.
285 // see: https://en.wikipedia.org/wiki/Windows_key
286 return 'Win';
287 }
288
289 // Note: To avoid using a Microsoft trademark, much Linux documentation refers to the key as "Super". This can confuse some users who still consider it a "Windows key". In KDE Plasma documentation it is called the Meta key even though the X11 "Super" shift bit is used.
290 // see: https://en.wikipedia.org/wiki/Super_key_(keyboard_button)
291 return 'Super';
292 }
293
294 default: {
295 throw new Error(key + 'unrecognized key');
296 }
297 }
298};
299
300/**
301 * Construct the display string of a key combination based on platform.

Callers 1

addModifierKeysFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected