diff --git a/src/components/settings/SettingsWindow.vue b/src/components/settings/SettingsWindow.vue index 9b67e6dd..97aea28a 100644 --- a/src/components/settings/SettingsWindow.vue +++ b/src/components/settings/SettingsWindow.vue @@ -26,6 +26,12 @@ +
+
+
Open wiki
+ +
+
Custom commands
diff --git a/src/main/PoeWindow.ts b/src/main/PoeWindow.ts index 7225af0e..df2a55dd 100644 --- a/src/main/PoeWindow.ts +++ b/src/main/PoeWindow.ts @@ -28,7 +28,7 @@ class PoeWindowClass extends EventEmitter { this.bounds = (await windowManager.getActiveWindowContentBounds())! this.pid = (await windowManager.getActiveWindowId())! } - }, 1000) + }, 500) } } diff --git a/src/main/shortcuts.ts b/src/main/shortcuts.ts index c5373d2a..d3ea06a4 100644 --- a/src/main/shortcuts.ts +++ b/src/main/shortcuts.ts @@ -7,6 +7,7 @@ import { showWindow, lockWindow, poeUserInterfaceWidth } from './positioning' import { KeyCodeToName } from '@/components/settings/KeyToCode' import { config } from './config' import { PoeWindow } from './PoeWindow' +import { openWiki } from './wiki' export let isPollingClipboard = false export let checkPressPosition: Point | undefined @@ -14,7 +15,7 @@ export let checkPressPosition: Point | undefined function priceCheck (lockedMode: boolean) { if (!isPollingClipboard) { isPollingClipboard = true - pollClipboard(32, 1000) + pollClipboard(32, 500) .then(async (clipboard) => { win.webContents.send('price-check', clipboard) await showWindow() @@ -59,6 +60,9 @@ export function setupShortcuts () { priceCheck(false) } else if (pressed === config.get('priceCheckLocked')) { priceCheck(true) + } else if (pressed === config.get('wikiKey')) { + pollClipboard(32, 500).then(openWiki).catch(() => {}) + robotjs.keyTap('key_c', ['control']) } else { const command = config.get('commands').find(c => c.hotkey === pressed) if (command) { diff --git a/src/main/wiki.ts b/src/main/wiki.ts new file mode 100644 index 00000000..1b90ee75 --- /dev/null +++ b/src/main/wiki.ts @@ -0,0 +1,15 @@ +import { shell } from 'electron' +import { parseClipboard, ItemRarity } from '../components/parser' + +const WIKI_URL = 'https://pathofexile.gamepedia.com' + +export function openWiki (clipboard: string) { + const item = parseClipboard(clipboard) + if (!item) return + + const pageName = (item.rarity === ItemRarity.Unique) + ? item.name + : item.baseType || item.name + + shell.openExternal(`${WIKI_URL}/${pageName}`) +} diff --git a/src/shared/types.ts b/src/shared/types.ts index 52600f50..27b71180 100644 --- a/src/shared/types.ts +++ b/src/shared/types.ts @@ -8,6 +8,7 @@ export interface Config { priceCheckKey: string priceCheckKeyHold: string priceCheckLocked: string + wikiKey: string commands: Array<{ text: string hotkey: string @@ -19,6 +20,7 @@ export const defaultConfig: Config = { priceCheckKey: 'D', priceCheckKeyHold: 'Ctrl', priceCheckLocked: 'Ctrl + Alt + D', + wikiKey: 'Alt + W', commands: [{ text: '/hideout', hotkey: 'F5'