From 0df650592c57c01aaba97ce7e014c14271d06e18 Mon Sep 17 00:00:00 2001 From: Alexander Drozdov Date: Thu, 20 Feb 2020 16:35:02 +0200 Subject: [PATCH] fix #2 --- src/main/PollClipboard.ts | 8 +++++++- src/main/shortcuts.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/PollClipboard.ts b/src/main/PollClipboard.ts index 12caa87f..a3317095 100644 --- a/src/main/PollClipboard.ts +++ b/src/main/PollClipboard.ts @@ -1,9 +1,15 @@ import { clipboard } from 'electron' +import { TAG_RARITY } from '../components/parser/constants' export async function pollClipboard (delay: number, limit: number): Promise { - const textBefore = clipboard.readText() + let textBefore = clipboard.readText() let elapsed = 0 + if (textBefore.startsWith(TAG_RARITY)) { + textBefore = '' + clipboard.writeText('') + } + return new Promise((resolve, reject) => { function poll () { const textAfter = clipboard.readText() diff --git a/src/main/shortcuts.ts b/src/main/shortcuts.ts index 7d1caec1..9a992e50 100644 --- a/src/main/shortcuts.ts +++ b/src/main/shortcuts.ts @@ -23,7 +23,7 @@ export function setupShortcuts () { ioHook.registerShortcut([KEY_CTRL, KEY_D], () => { if (!isPollingClipboard) { isPollingClipboard = true - pollClipboard(32, 1750) + pollClipboard(32, 1000) .then(async (clipboard) => { win.webContents.send('price-check', clipboard) poeWindowId = await windowManager.getActiveWindowId()