-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: goosewobbler <goosewobbler@pm.me> Co-authored-by: goosewobbler <goosewobbler@protonmail.com>
- Loading branch information
1 parent
811b48d
commit f7702e8
Showing
21 changed files
with
1,222 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import log from 'electron-log' | ||
|
||
import { v35StateSchema } from '../35/schema' | ||
|
||
import type { v37State } from './schema' | ||
|
||
const migrate = (initial: unknown) => { | ||
try { | ||
const state = v35StateSchema.parse(initial) | ||
const summonShortcutEnabled = state.main.shortcuts.altSlash | ||
|
||
const migratedState: v37State = { | ||
...state, | ||
main: { | ||
...state.main, | ||
shortcuts: { | ||
summon: { | ||
modifierKeys: ['Alt'], | ||
shortcutKey: 'Slash', | ||
enabled: summonShortcutEnabled, | ||
configuring: false | ||
} | ||
} | ||
} | ||
} | ||
|
||
return migratedState | ||
} catch (e) { | ||
log.error('Migration 37: could not parse state', e) | ||
} | ||
|
||
return initial | ||
} | ||
|
||
export default { | ||
version: 37, | ||
migrate | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { z } from 'zod' | ||
import { v35MainSchema, v35StateSchema } from '../35/schema' | ||
|
||
const v37ShortcutsSchema = z.object({ | ||
summon: z.object({ | ||
modifierKeys: z.array(z.enum(['Alt', 'Ctrl', 'Meta', 'Cmd'])), | ||
shortcutKey: z.string(), | ||
enabled: z.boolean(), | ||
configuring: z.boolean() | ||
}) | ||
}) | ||
|
||
const v37MainSchema = v35MainSchema.merge(z.object({ shortcuts: v37ShortcutsSchema })) | ||
const mainUpdates = z.object({ main: v37MainSchema }).passthrough() | ||
|
||
export const v37StateSchema = v35StateSchema.merge(mainUpdates).passthrough() | ||
|
||
export type v37State = z.infer<typeof v37StateSchema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { z } from 'zod' | ||
|
||
const supportedModifierKey = z.enum(['Alt', 'Control', 'Meta', 'Super', 'CommandOrCtrl']) | ||
|
||
const supportedShortcutKey = z.enum([ | ||
'Comma', | ||
'Period', | ||
'Forwardslash', | ||
'Slash', | ||
'Tab', | ||
'Space', | ||
'Enter', | ||
'Escape', | ||
'ArrowUp', | ||
'ArrowDown', | ||
'ArrowLeft', | ||
'ArrowRight', | ||
'F1', | ||
'F2', | ||
'F3', | ||
'F4', | ||
'F5', | ||
'F6', | ||
'F7', | ||
'F8', | ||
'F9', | ||
'F10', | ||
'F11', | ||
'Digit9', | ||
'Digit8', | ||
'Digit7', | ||
'Digit6', | ||
'Digit5', | ||
'Digit4', | ||
'Digit3', | ||
'Digit2', | ||
'Digit1', | ||
'Digit0', | ||
'KeyA', | ||
'KeyB', | ||
'KeyC', | ||
'KeyD', | ||
'KeyE', | ||
'KeyF', | ||
'KeyG', | ||
'KeyH', | ||
'KeyI', | ||
'KeyJ', | ||
'KeyK', | ||
'KeyL', | ||
'KeyM', | ||
'KeyN', | ||
'KeyO', | ||
'KeyP', | ||
'KeyQ', | ||
'KeyR', | ||
'KeyS', | ||
'KeyT', | ||
'KeyU', | ||
'KeyV', | ||
'KeyW', | ||
'KeyX', | ||
'KeyY', | ||
'KeyZ', | ||
'NumpadDivide', | ||
'NumpadMultiply', | ||
'NumpadSubtract', | ||
'NumpadAdd', | ||
'NumpadDecimal', | ||
'Numpad9', | ||
'Numpad8', | ||
'Numpad7', | ||
'Numpad6', | ||
'Numpad5', | ||
'Numpad4', | ||
'Numpad3', | ||
'Numpad2', | ||
'Numpad1', | ||
'Numpad0' | ||
]) | ||
|
||
export const ShortcutSchema = z.object({ | ||
modifierKeys: z.array(supportedModifierKey).default([]), | ||
shortcutKey: supportedShortcutKey, | ||
enabled: z.boolean().default(true), | ||
configuring: z.boolean().default(false) | ||
}) | ||
|
||
export type ModifierKey = z.infer<typeof supportedModifierKey> | ||
export type ShortcutKey = z.infer<typeof supportedShortcutKey> | ||
export type Shortcut = z.infer<typeof ShortcutSchema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.