Fix macos clipboard race condition
This commit is contained in:
@@ -16,8 +16,7 @@ import asyncio
|
|||||||
import websockets
|
import websockets
|
||||||
import socketserver
|
import socketserver
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image, UnidentifiedImageError
|
||||||
from PIL import UnidentifiedImageError
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from pynput import keyboard
|
from pynput import keyboard
|
||||||
from desktop_notifier import DesktopNotifierSync
|
from desktop_notifier import DesktopNotifierSync
|
||||||
@@ -882,7 +881,10 @@ def run():
|
|||||||
with objc.autorelease_pool():
|
with objc.autorelease_pool():
|
||||||
old_count = count
|
old_count = count
|
||||||
count = pasteboard.changeCount()
|
count = pasteboard.changeCount()
|
||||||
if not just_unpaused and count != old_count and NSPasteboardTypeTIFF in pasteboard.types():
|
if not just_unpaused and count != old_count:
|
||||||
|
while len(pasteboard.types()) == 0:
|
||||||
|
time.sleep(0.1)
|
||||||
|
if NSPasteboardTypeTIFF in pasteboard.types():
|
||||||
clipboard_text = ''
|
clipboard_text = ''
|
||||||
if NSPasteboardTypeString in pasteboard.types():
|
if NSPasteboardTypeString in pasteboard.types():
|
||||||
clipboard_text = pasteboard.stringForType_(NSPasteboardTypeString)
|
clipboard_text = pasteboard.stringForType_(NSPasteboardTypeString)
|
||||||
|
|||||||
@@ -35,9 +35,9 @@
|
|||||||
;api_key = api_key_here
|
;api_key = api_key_here
|
||||||
;endpoint = https://YOURPROJECT.cognitiveservices.azure.com/
|
;endpoint = https://YOURPROJECT.cognitiveservices.azure.com/
|
||||||
[mangaocr]
|
[mangaocr]
|
||||||
pretrained_model_name_or_path = kha-white/manga-ocr-base
|
;pretrained_model_name_or_path = kha-white/manga-ocr-base
|
||||||
force_cpu = False
|
;force_cpu = False
|
||||||
[easyocr]
|
[easyocr]
|
||||||
gpu = True
|
;gpu = True
|
||||||
[ocrspace]
|
[ocrspace]
|
||||||
;api_key = api_key_here
|
;api_key = api_key_here
|
||||||
Reference in New Issue
Block a user