class OtherChromeFinishersRule(MappingCountRule): mapping = aenea.configuration.make_grammar_commands( 'chrome', { 'next': DragonKey('rbracket:2'), 'pre': DragonKey('lbracket:2'), 'back <nn>': DragonKey('a-left:%(nn)d'), # 'w-lbracket:%(nn)d' 'forward <nn>': DragonKey('a-right:%(nn)d'), # 'w-rbracket:%(nn)d' 'fish | surf [<text>]': DragonKey('c-f') + DragonText('%(text)s'), })
class OtherChromeRepeatablesRule(MappingRule): mapping = { 'address [bar]': DragonKey('a-d'), # 'w-l' # 'top frame': DragonKey('g,s-f'), # 'next frame': DragonKey('g,f'), 'add bookmark': DragonKey('c-d'), # 'w-d' 'copy address': DragonKey('a-d/10,c-c'), # 'w-l,w-c' 'open': DragonKey('enter'), 'input': DragonKey('g,i'), }
class SharedChromeFinishersRule(MappingCountRule): mapping = aenea.configuration.make_grammar_commands( 'chrome', { 'reopen <nn>': DragonKey('cs-t:%(nn)d'), 'history': DragonKey('c-h'), # 'settings': DragonKey('c-comma'), 'downloads': DragonKey('c-j'), '[manage] bookmarks': DragonKey('cs-o'), 'developer tools': DragonKey('cs-i'), 'select element': DragonKey('cs-c'), 'extensions': DragonKey('c-t/50') + DragonText('chrome://extensions/\n'), # 'reopen <nn>': Key('ws-t:%(nn)d'), # 'history': Key('w-y'), # 'settings': Key('w-comma'), # 'downloads': Key('aw-l'), # '[manage] bookmarks': Key('aw-b'), # 'developer tools': Key('aw-i'), # 'exit': Key('w-q'), # 'select element': Key('cs-c'), })
class NotepadRepeatablesRule(MappingCountRule): mapping = aenea.configuration.make_grammar_commands( 'notepad', { # 'transfer that': DragonKey('c-a/3,c-c/3') + Pause('10') + Key('cwas-r') + Pause('50') + Key('w-v'), 'transfer that': Key('c-a/3,c-c/3,cws-f3/50,c-v') + command_mode, 'commit now': Key('c-s/5,cws-f3/50') + Text('git commit -F ~/.GIT_COMMIT_MSG') + Key('enter') + command_mode, 'commit amend now': Key('c-s/5,cws-f3/50') + Text('git commit -F --amend ~/.GIT_COMMIT_MSG') + Key('enter') + command_mode, 'word wrap': DragonKey('a-o/50,w'), 'undo': DragonKey('c-z'), })
class SharedChromeRepeatablesRule(MappingCountRule): mapping = aenea.configuration.make_grammar_commands( 'chrome', { '<jl_direct> <letter>': Function(ActivateLink), '<jl_new_tab> <letter>': Function(ActivateLinkNewTab), '<jl_hover> <letter>': Function(ActivateLinkHover), '<jl_copy_url> <letter>': Function(ActivateLinkCopyUrl), '<jl_copy_text> <letter>': Function(ActivateLinkCopyText), '"new tab"': DragonKey('c-t'), 'new window': DragonKey('c-n'), 'new incognito': DragonKey('cs-n'), 'teepee <nn>': DragonKey('c-%(nn)d'), 'teepee back': DragonKey('caret'), 'twink <nn>': DragonKey('cs-tab:%(nn)d'), 'trip <nn>': DragonKey('c-tab:%(nn)d'), 'steak': DragonKey('c-s'), 'stop': DragonKey('w-dot'), 'print': DragonKey('c-p'), 'zoom in <nn>': DragonKey('c-plus:%(nn)d'), 'zoom out <nn>': DragonKey('c-minus:%(nn)d'), 'zoom reset': DragonKey('c-0'), 'enable clicks': DragonKey('c-space/10,colon,plus,a,enter'), 'disable clicks': DragonKey('c-space/10,colon,minus,enter'), # 'links': DragonKey('c-m'), # 'tinks': DragonKey('c-k'), # 'multi links': DragonKey('a-f'), # 'copy link URL': DragonKey('y,f'), 'reload | refresh': DragonKey('c-r'), # 'duplicate tab | dope tab': DragonKey('y,t'), # '(pin | unpin) tab': DragonKey('a-p'), # 'move tab left': DragonKey('langle, langle'), # 'move tab right': DragonKey('rangle, rangle'), # '"new tab"': Key('w-t'), # 'new window': Key('w-n'), # 'new incognito': Key('ws-n'), # 'teepee <nn>': Key('w-%(nn)d'), # 'teepee back': Key('caret'), # 'twink <nn>': Key('cs-tab:%(nn)d'), # 'trip <nn>': Key('c-tab:%(nn)d'), # 'steak' : Key('w-s'), # 'stop' : Key('w-dot'), # 'print' : Key('w-p'), # 'zoom in <nn>': Key('w-plus:%(nn)d'), # 'zoom out <nn>': Key('w-minus:%(nn)d'), # 'links': Key('c-m'), # 'tinks': Key('c-k'), # 'multi links': Key('a-f'), # 'copy link URL': Key('y,f'), # 'reload | refresh': Key('w-r'), # 'duplicate tab | dope tab': Key('y,t'), # '(pin | unpin) tab': Key('a-p'), # 'move tab left': Key('langle, langle'), # 'move tab right': Key('rangle, rangle'), }) extras = [ NoCompile(Optional(Integer(min=0, max=100), default=1), name='nn'), Choice(name='jl_direct', choices=jump_letters_direct), Choice(name='jl_new_tab', choices=jump_letters_new_tab), Choice(name='jl_hover', choices=jump_letters_hover), Choice(name='jl_copy_url', choices=jump_letters_copy_url), Choice(name='jl_copy_text', choices=jump_letters_copy_text), Choice(choices=LETTERS, name='letter'), ]
def go(): temporary = Clipboard({Clipboard.format_text: command}) temporary.copy_to_system() DragonKey('cs-dot/10').execute()
'chrome': bring_chrome, # '[work] chrome <n>': Key('win:down/10,1:%(n)d/10,win:up/10'Slack) + normal_mode, '[work] chrome <n>': BringWindow(1, '%(n)d') + normal_mode, 'work chrome': BringWindow(1, 1) + normal_mode, # '[work] chrome <w2>': Function(BringWindow, w1=3), 'home chrome [<n>]': BringWindow(3, '%(n)d') + normal_mode, # '<desktop_name> chrome': Key('cw-%(desktop_name)d') + Pause('50') + bring_chrome + normal_mode, 'google for [<text>]': bring_chrome + Pause('50') + Key('c-t/50') + Text('%(text)s'), 'dictate (this|that)': remember_window + Key('c-c/10') + bring_notepad + DragonKey('c-a,del,c-v,c-end') + normal_mode, 'dictate all': remember_window + Key('c-a,c-c/10') + bring_notepad + DragonKey('c-a,del,c-v,c-end') + normal_mode, 'dictate new': remember_window + bring_notepad + DragonKey('c-a,del') + normal_mode, 'dictate': normal_mode + bring_notepad, # 'dictate code': Key('c-a/10,c-c/10,cw-f7') + Text('code') + Key('f12/100') + command_mode, # 'dictate python': [u'shared', u'rules'] Key('c-a/10,c-c/10,cw-f7/5') + Text('python .py') + Key('f12/100,a-v,s,p,p,p,p,p,enter') + command_mode, 'commit message': bring_commit_message + normal_mode, 'new commit message': remember_window + bring_commit_message + Pause('100') + Key('c-a,del') + normal_mode, 'website <common_websites>':
class InboxFinishersRule(MappingRule): mapping = { 'inbox': DragonKey('g,i'), 'reply all': DragonKey('a'), 'reply': DragonKey('r'), 'forward': DragonKey('f'), 'move to': DragonKey('dot'), 'bold that': DragonKey('w-b'), 'italics that': DragonKey('w-i'), 'underline that': DragonKey('w-u'), 'indent': DragonKey('w-['), 'unindent': DragonKey('w-]'), '(hyperlink that | insert hyperlink)': DragonKey('w-k'), 'numbered list': DragonKey('w-7'), 'bulleted list': DragonKey('w-8'), 'remove formatting': DragonKey('w-backslash'), }
class InboxRepeatablesRule(MappingCountRule): mapping = { 'next [item] <nn>': DragonKey('right:%(nn)d'), 'pre [item] <nn>': DragonKey('left:%(nn)d'), 'next mess <nn>': DragonKey('n:%(nn)d'), 'pre mess <nn>': DragonKey('p:%(nn)d'), # 'undo': DragonKey('z'), 'open': DragonKey('o'), 'close': DragonKey('u'), 'surf': DragonKey('slash'), 'done | archive': DragonKey('e'), 'compose': DragonKey('c'), 'add reminder': DragonKey('t'), 'spam': DragonKey('exclamation'), 'send': DragonKey('c-enter'), 'trash': DragonKey('hash'), 'mark <nn>': DragonKey('x/20,down') * Repeat(extra="nn"), 'finish cheers': DragonText('\r\rCheers,\rJoep'), 'finish thanks': DragonText('\r\rThanks,\rJoep'), 'finish best': DragonText('\r\rBest,\rJoep'), 'finish kind regards': DragonText('\r\rKind regards,\rJoep Moritz'), }