def startScrolling(m): global scrollJob scrollJob = cron.interval('500ms', scrollMe)
def startCursorScrolling(m): global gazeJob stopScrolling(m) gazeJob = cron.interval("60ms", gazeScroll)
def start_cursor_scrolling(): global active_job stop_scrolling() active_job = cron.interval("60ms", scroll_by_cursor)
ctrl.mouse_scroll(y=scrollAmount) def startScrolling(m): global scrollJob scrollJob = cron.interval('500ms', scrollMe) def stopScrolling(m): global scrollAmount, scrollJob scrollAmount = 0 cron.cancel(scrollJob) scrollAmount = 0 scrollJob = cron.interval('500ms', scrollMe) ctx.keymap({ "click": delayed_click, "click right": delayed_right_click, "click double": delayed_dubclick, "click triple": delayed_tripclick, "drag": mouse_drag, "release": mouse_release, "wheel down": mouse_scroll(300), "wheel up": mouse_scroll(-300), # "wheel continuous": startScrolling, "wheel stop": stopScrolling, "click command": adv_click(0, "cmd"), "click control": adv_click(0, "ctrl"), "click (option | opt)": adv_click(0, "alt"),
# fullscreen, so deadzones are used for debouncing. if should_record: if (not recording() and time.monotonic() > _last_transition + TRANSITION_DEADZONE): _last_transition = time.monotonic() noise, existing = noise_with_least_data() LOGGER.info(f'Recording noise with the least data: "{noise}", ' f"{existing / 60:0.1f} mins exist already.") record(noise) # TODO: Probably enable a tag here so people can hook behaviour elif recording( ) and time.monotonic() > _last_transition + TRANSITION_DEADZONE: _last_transition = time.monotonic() stop() # Lambda is used becayse Python thinks `print_total_noise_recorded` # isn't callable. cron.after("2s", actions.self.print_total_noise_recorded) @imgui.open(software=False, y=0, x=0) def gui(gui: imgui.GUI): global _current_noise # TODO: Animate this? # # TODO: Make it red & bold? gui.text(f'Recording "{_current_noise}"...') #### Comment out this line to disable the script: #### cron.interval("100ms", _maybe_record)
def start_scroll(): global scroll_job scroll_job = cron.interval("60ms", scroll_continuous_helper)
def enable(self): if not self.enabled: self.enabled = True self.should_open = True self.job = cron.interval("100ms", self.state_check)
def startClicking(m): global clickJob clickJob = cron.interval("30ms", click_me)
if _lastTerminalLsof and lsof != _lastTerminalLsof: _inTerminal = True _lastTerminalLsof = lsof else: _inTerminal = False _lastEditorSelection = editorSelection # if _inTerminal: # print("TERMINAL: {}".format(editorSelection)) return _inTerminal else: print("Rest API does not have 'port' setting.") return False ctx = Context("vscodeterminal", func=TerminalContext) ctx.keymap({"testing": "vscode testing"}) def _updateScope(): global _terminalContextJob if active_app().bundle == "com.microsoft.VSCode": print("In vscode, updating scope...") talon.update_scope() else: cron.cancel(_terminalContextJob) _terminalContextJob = None _terminalContextJob = cron.interval('2s', _updateScope)
json={"userId": WEBHOOK_ID, "actionFields": {"color": color}}, headers={"Content-Type": "application/json"}, ).raise_for_status() else: cmd = SHELL_BLINK.format(color=COLOR, blink=color) subprocess.check_call(cmd, shell=True) def set_color_for_main(): base_color = "red" if tcg.enabled else "green" if running_screensaver(): solid_color("blue", mini=base_color) else: solid_color(base_color) def running_screensaver(): return ( applescript.run( """ tell application "System Events" get running of screen saver preferences end tell """ ) == "true" ) cron.interval("2s", set_color_for_main)
def enable(self): if not self.enabled: self.job = cron.interval("200ms", self.language_check) self.enabled = True
def start_step(): global step_job step_job = cron.interval("250ms", step_continuous_helper(direction))
def enable(self): if self.job is None and self.list is not None: self.enabled = True self.should_open = True self.job = cron.interval("200ms", self.list_check)
def register(self, name, callback): current_callback_amount = len(self.callbacks.values()) self.callbacks[name] = callback if (current_callback_amount == 0): self.job = cron.interval("200ms", self.state_check)
with _socket_lock: if emacs_focussed() and _socket: try: # TODO: Why pending lock here with _pending_lock: # TODO: What if the second half of a message gets dropped, will # this still work? _socket.sendall("\0\1\0".encode()) except: # Seems like even with this, sometimes the receive thread D/C isn't # triggered. Just force it. _force_disconnect() def run_command(command, prefix_arg=None): # TODO: Still need to pause if e.g. a key was just pressed? Can it still # inject too early? # # FIXME: With e.g. the it commands, this is too fast. Need to ensure the # stuff gets into the command loop, I think. return rpc_call("voicemacs-inject-command", params=[command, prefix_arg]) cron.interval(f"{_CONNECT_ATTEMPT_INTERVAL}ms", _try_connect) # HACK: Disconnect doesn't always trigger in the receive thread until a message # is sent. Manually ping to trigger these D/Cs. # # FIXME: Something is causing Talon to silently deadlock. I think it's Voicemacs # and I think it's probably the message system deadlocking. cron.interval(f"{_PING_INTERVAL}ms", _ping)
def soft_enable(self): if not self.soft_enabled: self.soft_enabled = True self.mouse_poller = cron.interval("30ms", self.poll_mouse_pos) if self.canvas: self.canvas.resume()
_inTerminal = True _lastTerminalLsof = lsof else: _inTerminal = False _lastEditorSelection = editor_selection # if _inTerminal: # print("TERMINAL: {}".format(editor_selection)) return _inTerminal else: print("Rest API does not have 'port' setting.") return False ctx = Context("vscodeterminal", func=terminal_context) ctx.keymap({"testing": "vscode testing"}) def _update_scope(): global _terminalContextJob if active_app().bundle == "com.microsoft.VSCode": # print("In vscode, updating scope...") talon.update_scope() else: cron.cancel(_terminalContextJob) _terminalContextJob = None if ENABLED: _terminalContextJob = cron.interval("2s", _update_scope)
def startScrolling(m): global scrollJob scrollJob = cron.interval("60ms", scrollMe)
def enable(self): if (self.enabled != True): self.enabled = True speech_system.register("phrase", self.on_phrase) if (self.job is None): self.job = cron.interval('100ms', self.state_check)
def start(self): self._update_scroll() self._job = cron.interval(self._POLL_INTERVAL, self._update_scroll)
command_exes = ["code.exe", "mintty.exe", "kindle.exe"] command_titles = ["JupyterLab"] in_command_context = None def switch_command(): engine.mimic("switch to command mode") def switch_normal(): engine.mimic("switch to normal mode") def check_context(): global in_command_context if actions.context_matches(command_titles, command_exes)(ui.active_app(), ui.active_window()): if in_command_context is None or not in_command_context: switch_command() in_command_context = True else: if in_command_context is None or in_command_context: switch_normal() in_command_context = False cron.interval("1s", check_context)
def start_cursor_scrolling(): global scroll_job, gaze_job stop_scroll() gaze_job = cron.interval("60ms", gaze_scroll)
def start_scrolling(interval: str, speed: int): global active_job stop_scrolling() active_job = cron.interval( interval, lambda: actions.mouse_scroll(by_lines=False, y=speed))