def __init__(self): super(Controller, self).__init__() self._mapping = get_unicode_to_keycode_map()
import subprocess import logging from psutil import pid_exists from pynput import keyboard, mouse from pynput.keyboard import Key, KeyCode from pynput._util.darwin import get_unicode_to_keycode_map from AppKit import NSWorkspace, NSRunningApplication from Foundation import NSAppleScript import Quartz from .app import App MOUSE_CLIP_X_MARGIN = 50 UNICODE_TO_KEYCODE_MAP = get_unicode_to_keycode_map() MOONLIGHT_BUNDLE_ID = 'com.moonlight-stream.Moonlight' MOONLIGHT_APP_NAME = 'Moonlight' logger = logging.getLogger('moonlight-desktop') def clip(val, min_, max_): return min_ if val < min_ else max_ if val > max_ else val def get_active_app_bundle_id(): return NSWorkspace.sharedWorkspace().frontmostApplication( ).bundleIdentifier()