예제 #1
0
        sleep(0.5)
        press('cmd-shift-alt-d')


def talon_mode(m):
    global is_swedish_mode
    speech.set_enabled(True)
    engine.mimic('go to sleep'.split())
    if is_swedish_mode == True:
        is_swedish_mode = False
        sleep(0.5)
        press('cmd-shift-alt-d')


def dragon_mode(m):
    speech.set_enabled(False)
    engine.mimic('wake up'.split())


sleep_group = ContextGroup('sleepy')
sleepy = Context('sleepy', group=sleep_group)

sleepy.keymap({
    'snore': lambda m: speech.set_enabled(False),
    'activate': lambda m: speech.set_enabled(True),
    'dragon mode': dragon_mode,
    'talon mode': talon_mode,
    'swedish mode': swedish_mode,
})
sleep_group.load()
예제 #2
0
    # "drag down": idea("action MoveLineDown"),
    # "duplicate": idea("action EditorDuplicate"),
    # "(go | jump) back": idea("action Back"),
    # "(go | jump) forward": idea("action Forward"),
    # "(synchronizing | synchronize)": idea("action Synchronize"),
    # "comment": idea("action CommentByLineComment"),
    # "(action | please) [<dgndictation>]": [idea("action GotoAction"), text],
    # f"(go to | jump to) {optional_numerals}": idea_num("goto {} 0", drop=2),
    # f"clone line {optional_numerals}": idea_num("clone {}", drop=2),
    # f"grab {optional_numerals}": grab_identifier,
    # "(start | stop) recording": idea("action StartStopMacroRecording"),
    # "edit (recording | recordings)": idea("action EditMacros"),
    # "play recording": idea("action PlaybackLastMacro"),
    # "play recording <dgndictation>": [
    #     idea("action PlaySavedMacrosAction"),
    #     text,
    #     Key("enter"),
    # ],
    # "show (mark | marks | bookmark | bookmarks)": idea("action ShowBookmarks"),
    # "[toggle] (mark | bookmark)": idea("action ToggleBookmark"),
    # "next (mark | bookmark)": idea("action GotoNextBookmark"),
    # "(last | previous) (mark | bookmark)": idea("action GotoPreviousBookmark"),
    # f"(mark | bookmark) (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)": idea_num(
    #     "action ToggleBookmark{}", drop=1, zero_okay=True
    # ),
    # f"(jump | go) (mark | bookmark) (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)": idea_num(
    #     "action GotoBookmark{}", drop=2, zero_okay=True
    # ),
})
group.load()
예제 #3
0
    # Enable/disable debug logging to console
    'talon [voice] debugging on':
    lambda m: set_debug_enabled(True),
    'talon [voice] debugging off':
    lambda m: set_debug_enabled(False),

    # Open talon.log in Console.app
    'talon show log':
    open_debug_log,

    # Toggle various eye tracking systems
    'talon (calibrate | calibration)':
    lambda m: on_eye_control('Eye Tracking >> Calibrate'),
    'talon mouse [control]':
    lambda m: on_eye_control('Eye Tracking >> Control Mouse'),
    'talon zoom [mouse]':
    lambda m: on_eye_control('Eye Tracking >> Control Mouse (Zoom)'
                             ),  # Currently doesn't work for unknown reasons
    'talon keyboard':
    lambda m: on_eye_control('Eye Tracking >> Keyboard'
                             ),  # Currently doesn't work for unknown reasons
    'talon eye debug':
    lambda m: on_eye_control('Eye Tracking >> Show Debug Overlay'),
    'talon eye camera':
    lambda m: on_eye_control('Eye Tracking >> Show Camera Overlay'),
})

# Startup.
enable_talon()
context_group.load()
예제 #4
0
from talon import tap, voice
from talon.voice import Context, ContextGroup
from talon.engine import engine
from talon_plugins import speech

sleep_group = ContextGroup("sleepy")
sleepy = Context("sleepy", group=sleep_group)

dictation_group = ContextGroup("dictation")
dictation = Context("dictation", group=dictation_group)
dictation_group.load()
dictation_group.disable()


class VoiceType:
    SLEEPING = 1
    TALON = 2
    DRAGON = 3
    DICTATION = 4


voice_type = VoiceType.TALON
last_voice_type = VoiceType.TALON


def set_voice_type(type):
    global voice_type, last_voice_type
    if voice_type != VoiceType.SLEEPING:
        last_voice_type = voice_type
    voice_type = type
예제 #5
0
    def insert_word(self, word):
        word = str(word).lstrip("\\").split("\\", 1)[0]
        word = mapping.get(word, word)
        word = word.rstrip("-")

        if self.caps:
            word = word[0].upper() + word[1:]

        if self.space and word[0] not in punctuation and "\n" not in word:
            insert(" ")

        insert(word)

        self.caps = word in sentence_ends
        self.space = "\n" not in word

    def phrase(self, m):
        for word in m.dgndictation[0]:
            self.insert_word(word)


dictation_group = ContextGroup("dictation")
dictation = Context("dictation", group=dictation_group)
dictation_group.load()
dictation_group.disable()

auto_format = AutoFormat()
dictation.keymap({"<dgndictation> [over]": auto_format.phrase})
# , "press enter": Key("enter")