Last active
September 3, 2021 05:00
-
-
Save lucasluitjes/451795a3a58f780444e59af887e70ed5 to your computer and use it in GitHub Desktop.
automatically generate a click for the talon zoom mouse every n seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script automatically generates a pop for the talon zoom mouse every n seconds, | |
# then another one 2 seconds later. For when you want to do a ton of clicking actions | |
# without getting jaw cramp. If you don't want to click, just look away within 2 seconds. | |
from talon import Context, Module, actions, app, cron, ctrl, imgui, noise, settings, ui | |
from talon_plugins import eye_mouse, eye_zoom_mouse, speech | |
from talon_plugins.eye_mouse import config, toggle_camera_overlay, toggle_control | |
# Put the following at the bottom of talon/resources/talon_plugins/eye_zoom_mouse.py | |
# (you will need to reapply this after every talon update) | |
# | |
# def simulate_zoom_pop(): | |
# zoom_mouse.on_pop(False) | |
class config: | |
auto_pop_enabled = False | |
cronjob = None | |
speed = 10 | |
def first_pop(): | |
if config.auto_pop_enabled: | |
eye_zoom_mouse.simulate_zoom_pop() | |
cron.after("2000ms", second_pop) | |
def second_pop(): | |
eye_zoom_mouse.simulate_zoom_pop() | |
config.cronjob = cron.interval("10000ms", first_pop) | |
mod = Module() | |
@mod.action_class | |
class Actions: | |
def enable_auto_pop(): | |
"""Enables auto pop""" | |
config.auto_pop_enabled = True | |
def disable_auto_pop(): | |
"""Disables auto pop""" | |
config.auto_pop_enabled = False | |
def auto_pop_faster(): | |
"""Speeds up auto pop""" | |
config.speed -= 5 | |
if config.speed < 5: | |
config.speed = 5 | |
cron.cancel(config.cronjob) | |
config.cronjob = cron.interval("{}000ms".format(config.speed), first_pop) | |
actions.user.notify("Speed set to {}".format(config.speed)) | |
def auto_pop_slower(): | |
"""Slows down auto pop""" | |
config.speed += 5 | |
cron.cancel(config.cronjob) | |
config.cronjob = cron.interval("{}000ms".format(config.speed), first_pop) | |
actions.user.notify("Speed set to {}".format(config.speed)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment