class HardwareRule(MappingRule): mapping = { # Windows 10 changes volume by increments 2 "volume <volume_mode> [<n_volume>]": R(Key("%(volume_mode)s") * Repeat(extra="n_volume")), "media <multimedia_control> [<n_media>]": R(Key("%(multimedia_control)s") * Repeat(extra="n_media")), "change monitor": R(Key("w-p") + Pause("100") + Function(change_monitor)) } extras = [ IntegerRefST("n_media", 1, 15), IntegerRefST("n_volume", 1, 50), Choice("multimedia_control", { "next": "tracknext", "back": "trackprev", "play|pause": "playpause", }), Choice("volume_mode", { "mute|unmute": "volumemute", "up": "volumeup", "down": "volumedown", }) ] defaults = { "n_volume": 1, "n_media": 1, "volume_mode": "setsysvolume", }
class SSMSRule(MappingRule): mapping = { # There doesn't seem to be a hotkey for sequential tab navigation in SSMS, but something is better than nothing... "next tab [<n>]": R(Key("c-tab")) * Repeat(extra="n"), "prior tab [<n>]": R(Key("cs-tab")) * Repeat(extra="n"), "close tab [<n>]": R(Key("c-f4/20")) * Repeat(extra="n"), "go to line": R(Key("c-g")), "comment line": R(Key("c-k, c-c")), "comment block": R(Key("c-k, c-c")), "(un | on) comment line": R(Key("c-k/50, c-u")), "(un | on) comment block": R(Key("c-k/50, c-u")), "[toggle] full screen": R(Key("sa-enter")), "(set | toggle) bookmark": R(Key("c-k, c-k")), "next bookmark": R(Key("c-k, c-n")), "prior bookmark": R(Key("c-k, c-p")), "[toggle] break point": R(Key("f9")), "step over [<n>]": R(Key("f10/50") * Repeat(extra="n")), "step into": R(Key("f11")), "step out [of]": R(Key("s-f11")), "resume": R(Key("f5")), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class CommandRule(MappingRule): mapping = { "next tab [<n>]": R(Key("c-pgdown") * Repeat(extra="n"), rdescript="Notepad++: Next Tab"), "prior tab [<n>]": R(Key("c-pgup") * Repeat(extra="n"), rdescript="Notepad++: Prior Tab"), "close tab [<n>]": R(Key("c-w") * Repeat(extra="n"), rdescript="Notepad++: Close Tab"), "stylize <n2>": R(Mouse("right") + Key("down:6/5, right") + (Key("down") * Repeat(extra="n2")) + Key("enter"), rdescript="Notepad++: Stylize"), "remove style": R(Mouse("right") + Key("down:6/5, right/5, down:5/5, enter"), rdescript="Notepad++: Remove Style"), "preview in browser": R(Key("cas-r"), rdescript="Notepad++: Preview In Browser"), # requires function list plug-in: "function list": R(Key("cas-l"), rdescript="Notepad++: Function List"), } extras = [ Dictation("text"), IntegerRef("n", 1, 100), IntegerRef("n2", 1, 10), ] defaults = {"n": 1}
class GitHubRule(MergeRule): pronunciation = "github" mapping = { "new repository": R(Key("c-n")), "add local repository": R(Key("c-o")), "clone repository": R(Key("c-o")), "options": R(Key("c-comma")), "changes": R(Key("c-1")), "history": R(Key("c-2")), "(repositories | repository list)": R(Key("c-t")), "branches [list]": R(Key("c-b")), "zoom in [<n>]": R(Key("c-equals")) * Repeat(extra="n"), "zoom out [<n>]": R(Key("c-minus")) * Repeat(extra="n"), "reset zoom": R(Key("c-0")), "push [repository]": R(Key("c-p")), "pull [repository]": R(Key("cs-p")), "remove repository": R(Key("c-delete")), "view on github": R(Key("cs-g")), "(terminal | command prompt)": R(Key("c-backtick")), "explorer": R(Key("cs-f")), "edit": R(Key("cs-a")), "new branch": R(Key("cs-n")), "rename branch": R(Key("cs-r")), "delete branch": R(Key("cs-d")), "update from master": R(Key("cs-u")), "compare to [branch]": R(Key("cs-b")), "merge into current [branch]": R(Key("cs-m")), "compare on github": R(Key("cs-c")), "create pull request": R(Key("c-r")), } extras = [ IntegerRefST("n", 1, 10), ] defaults = {"n": 1}
class WindowManagementRule(MappingRule): mapping = { 'maximize': R(Function(utilities.maximize_window)), 'minimize': R(Function(utilities.minimize_window)), # Workspace management "show work [spaces]": R(Key("w-tab")), "(create | new) work [space]": R(Key("wc-d")), "close work [space]": R(Key("wc-f4")), "close all work [spaces]": R(Function(virtual_desktops.close_all_workspaces)), "next work [space] [<n>]": R(Key("wc-right"))*Repeat(extra="n"), "(previous | prior) work [space] [<n>]": R(Key("wc-left"))*Repeat(extra="n"), "go work [space] <n>": R(Function(virtual_desktops.go_to_desktop_number)), "send work [space] <n>": R(Function(virtual_desktops.move_current_window_to_desktop)), "move work [space] <n>": R(Function(virtual_desktops.move_current_window_to_desktop, follow=True)), } extras = [ IntegerRefST("n", 1, 20, default=1), ]
class MSTeamsRule(MappingRule): name = "microsoft teams" mapping = { # General "search": R(Key("c-e")), "keyboard shortcuts": R(Key("c-.")), "settings": R(Key("c-comma")), "help": R(Key("f1")), "commands": R(Key("c-slash")), "filter": R(Key("cs-f")), "go to": R(Key("c-g")), "new chat": R(Key("c-n")), # Navigation "activity": R(Key("c-1")), "chat": R(Key("c-2")), "teams": R(Key("c-3")), "calendar": R(Key("c-4")), "calls": R(Key("c-5")), "files": R(Key("c-6")), "shifts": R(Key("c-7")), "previous item [<nnavi10>]": R(Key("a-up")) * Repeat(extra="nnavi10"), "next item [<nnavi10>]": R(Key("a-down")) * Repeat(extra="nnavi10"), "previous team": R(Key("cs-up")), "next team": R(Key("cs-down")), "previous section": R(Key("cs-f6")), "next section": R(Key("c-f6")), # Messaging "focus compose": R(Key("c")), "expand compose": R(Key("cs-x")), "send": R(Key("c-enter")), "attach": R(Key("c-o")), "new-line": R(Key("s-enter")), "reply": R(Key("r")), # meetings calls and calendar "Accept [video] call": R(Key("cs-a")), "Accept [audio] call": R(Key("cs-")), "decline [call]": R(Key("cs-d")), "start audio call": R(Key("cs-c")), "Start video call": R(Key("cs-u")), "toggle mute": R(Key("cs-m")), "screen share": R(Key("cs-e")), "toggle video": R(Key("cs-o")), "sharing toolbar": R(Key("cs-space")), "decline screen share": R(Key("cs-d")), "Accept screen share": R(Key("cs-a")), "Schedule meeting": R(Key("as-n")), "go to current time": R(Key("a-.")), "go to previous (day | week)": R(Key("ca-left")), "go to next (day | week)": R(Key("ca-right")), "View day": R(Key("ca-1")), "View workweek": R(Key("ca-2")), "View week": R(Key("ca-3")), } exported = True extras = [IntegerRefST("nnavi10", 1, 11)] defaults = {"nnavi10": 1}
class FlashDevelopRule(MergeRule): pronunciation = "flash develop" mapping = { "prior tab [<n>]": R(Key("c-pgup"), rdescript="FlashDevelop: Previous Tab") * Repeat(extra="n"), "next tab [<n>]": R(Key("c-pgdown"), rdescript="FlashDevelop: Next Tab") * Repeat(extra="n"), "open resource": R(Key("c-r"), rdescript="FlashDevelop: Open Resource"), "jump to source": R(Key("f4"), rdescript="FlashDevelop: Jump To Source"), "jump away": R(Key("s-f4"), rdescript="FlashDevelop: Jump Away"), "step over [<n>]": R(Key("f10") * Repeat(extra="n"), rdescript="FlashDevelop: Step Over"), "step into": R(Key("f11"), rdescript="FlashDevelop: Step Into"), "step out [of]": R(Key("s-f11"), rdescript="FlashDevelop: Step Out"), "resume": R(Key("a-d, c"), rdescript="FlashDevelop: Resume"), "terminate": R(Key("s-f5"), rdescript="FlashDevelop: Terminate Running Program"), "find everywhere": R(Key("cs-f"), rdescript="FlashDevelop: Search Project"), "refractor symbol": R(Key("a-r, r"), rdescript="FlashDevelop: Re-Factor Symbol"), "symbol next [<n>]": R(Key("f3"), rdescript="FlashDevelop: Symbol Next") * Repeat(extra="n"), "symbol prior [<n>]": R(Key("s-f3"), rdescript="FlashDevelop: Symbol Prior") * Repeat(extra="n"), "format code": R(Key("cs-2"), rdescript="FlashDevelop: Format Code"), "comment line": R(Key("c-q"), rdescript="FlashDevelop: Comment Line"), "clean it": R(Key("s-f8"), rdescript="FlashDevelop: Clean"), "build it": R(Key("f8"), rdescript="FlashDevelop: Build"), "(debug | run) last": R(Key("f5"), rdescript="FlashDevelop: Run"), "split view horizontal": R(Key("cs-enter"), rdescript="FlashDevelop: Split View (H)"), "auto complete": R(Key("cs-1"), rdescript="FlashDevelop: Auto Complete"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class TexmakerRule(MergeRule): pronunciation = "texmaker" mapping = { # file "new [file]": Key("c-n"), "open": Key("c-o"), "open recent": Key("a-f, down:3, right"), "close": Key("c-w"), "exit": Key("c-q"), "restore previous session": Key("cs-f8"), # edit "[go to] line <m>": Key("c-g") + Text("%(m)s") + Key("enter"), "comment": Key("c-t"), "uncomment": Key("c-u"), "indent": Key("c-rangle"), "(outdent | unindent)": Key("c-langle"), "find [<text>]": Key("c-f/5") + Text("%(text)s"), "find next [<n>]": Key("c-m") * Repeat(extra="n"), "replace": Key("c-r"), "check spelling": Key("cs-f7"), "refresh structure": Key("cs-f1"), # tools # if you have f1 set to turn on/off microphone, you will need to reset the Texmaker shortcut "quick build": Key("f1"), # "LaTeX": Key("f2"), # not sure what this does so I'm going to comment it out "view DVI": Key("f3"), "DVI to postscript": Key("f4"), "view postscript": Key("f5"), "PDF latex": Key("f6"), "view PDF": Key("f7"), "postscript to PDF": Key("f8"), "DVI to PDF": Key("f9"), "view log": Key("f10"), "bibtech": Key("f11"), "make index": Key("f12"), # view # Texmaker doesn't seem to have tabs unless I'm missing something "next (document | dock) [<n>]": Key("a-pgdown") * Repeat(extra='n'), "(previous | prior) (document | dock)": Key("a-pgup") * Repeat(extra='n'), "full-screen": Key("cs-f11"), "switch pane": Key("c-space"), # switch between editor and embedded viewer } extras = [ Dictation("text"), IntegerRef("n", 1, 10), IntegerRef("m", 1, 1000), ] defaults = {}
class FlashDevelopRule(MappingRule): mapping = { "prior tab [<n>]": R(Key("c-pgup")) * Repeat(extra="n"), "next tab [<n>]": R(Key("c-pgdown")) * Repeat(extra="n"), "open resource": R(Key("c-r")), "jump to source": R(Key("f4")), "jump away": R(Key("s-f4")), "step over [<n>]": R(Key("f10") * Repeat(extra="n")), "step into": R(Key("f11")), "step out [of]": R(Key("s-f11")), "resume": R(Key("a-d, c")), "terminate": R(Key("s-f5")), "find everywhere": R(Key("cs-f")), "refractor symbol": R(Key("a-r, r")), "symbol next [<n>]": R(Key("f3")) * Repeat(extra="n"), "symbol prior [<n>]": R(Key("s-f3")) * Repeat(extra="n"), "format code": R(Key("cs-2")), "comment line": R(Key("c-q")), "clean it": R(Key("s-f8")), "build it": R(Key("f8")), "(debug | run) last": R(Key("f5")), "split view horizontal": R(Key("cs-enter")), "auto complete": R(Key("cs-1")), "[go to] line <n>": R(Key("c-g") + Pause("50") + Text("%(n)d") + Key("enter")), } extras = [ Dictation("text"), Dictation("mim"), ShortIntegerRef("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class FoxitRule(MappingRule): mapping = { "next tab [<n>]": R(Key("c-tab")) * Repeat(extra="n"), "prior tab [<n>]": R(Key("cs-tab")) * Repeat(extra="n"), "close tab [<n>]": R(Key("c-f4/20")) * Repeat(extra="n"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class LyxRule(MergeRule): pronunciation = "lyx" mapping = { "new file": R(Key("c-n"), rdescript="LyX: new file"), "open file": R(Key("c-o"), rdescript="LyX: open file"), "save as": R(Key("cs-s"), rdescript="LyX: save as"), "math mode": R(Key("c-m"), rdescript="LyX: math mode"), "display mode": R(Key("cs-m"), rdescript="LyX: display mode"), "view PDF": R(Key("c-r"), rdescript="LyX: view PDF"), "update PDF": R(Key("cs-r"), rdescript="LyX: update PDF"), "move line up [<n>]": R(Key("a-up"), rdescript="LyX: move line up") * Repeat(extra="n"), "move line down [<n>]": R(Key("a-down"), rdescript="LyX: move line down") * Repeat(extra="n"), "insert <environment>": R(Key("a-i, h, %(environment)s"), rdescript="LyX: insert environment"), } extras = [ IntegerRefST("n", 1, 10), Choice( "environment", { "(in line formula | in line)": "i", "(display formula | display)": "d", "(equation array environment | equation array)": "e", "(AMS align environment | AMS align)": "a", "AMS align at [environment]": "t", "AMS flalign [environment]": "f", "(AMS gathered environment | AMS gather)": "g", "(AMS multline [environment]| multiline)": "m", "array [environment]": "y", "(cases [environment] | piecewise)": "c", "(aligned [environment] | align)": "l", "aligned at [environment]": "v", "gathered [environment]": "h", "split [environment]": "s", "delimiters": "r", "matrix": "x", "macro": "o", }), ] defaults = { "n": 1, }
class FirefoxRule(MappingRule): _mapping = { browser_shared.PREVIOUS_TAB_N_TIMES: # control shift tab doesn't work and this appears to be an undocumented workaround R(Key("c-tab/30")) * Repeat(extra="n"), browser_shared.FIND_NEXT_MATCH: R(Key("c-g/20")) * Repeat(extra="n"), browser_shared.TOGGLE_BOOKMARK_TOOLBAR: R(Key("c-b")), browser_shared.SHOW_EXTENSIONS: R(Key("a-a, l, e/15, enter")), } mapping = BrowserSharedCommands.merge_dictionaries( _mapping, BrowserSharedCommands.chromeAndFirefoxMapping) extras = browser_shared.get_extras() defaults = browser_shared.get_defaults()
class MSVCRule(MappingRule): mapping = { "cursor prior": R(Key("c-minus")), "cursor next": R(Key("cs-minus")), "toggle full screen": R(Key("sa-enter")), "resolve": R(Key("c-dot")), "jump to source": R(Key("f12")), "snippet": R(Key("tab")), "step over [<n>]": R(Key("f10/50") * Repeat(extra="n")), "step into": R(Key("f11")), "step out [of]": R(Key("s-f11")), "resume": R(Key("f8")), "build [last]": R(Key("ca-f7")), "debug [last]": R(Key("f5")), "comment out": R(Key("c-k/50, c-c")), "on comment out": R(Key("c-k/50, c-u")), "set bookmark": R(Key("c-k, c-k")), "next bookmark": R(Key("c-k, c-n")), "break point": R(Key("f9")), "format code": R(Key("cs-f")), "(do imports | import all)": R(Key("cs-o")), "comment line": R(Key("c-slash")), "go to line": R(Key("c-g")), } extras = [ Dictation("text"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1}
class Decker(MergeRule): pronunciation = "test rule" mapping = { "doon [<nnavi200>]": R(Key("pagedown")) * Repeat(extra="nnavi200"), } extras = [IntegerRefST("n", 1, 50), IntegerRefST("nnavi200", 1, 200)]
class NPPRule(MappingRule): mapping = { "stylize <n2>": R( Mouse("right") + Key("down:6/5, right") + (Key("down") * Repeat(extra="n2")) + Key("enter")), "remove style": R(Mouse("right") + Key("down:6/5, right/5, down:5/5, enter")), "preview in browser": R(Key("cas-r")), # requires function list plug-in: "function list": R(Key("cas-l")), "open": R(Key("c-o")), "go [to] line <n>": R(Key("c-g/10") + Text("%(n)s") + Key("enter")), } extras = [ Dictation("text"), IntegerRefST("n", 1, 1000), IntegerRefST("n2", 1, 10), ] defaults = {"n": 1}
class SSMSRule(MergeRule): pronunciation = "sequel server management studio" mapping = { # There doesn't seem to be a hotkey for sequential tab navigation in SSMS, but something is better than nothing... "next tab [<n>]": R(Key("c-tab"), rdescript="SSMS: Next Tab") * Repeat(extra="n"), "prior tab [<n>]": R(Key("cs-tab"), rdescript="SSMS: Previous Tab") * Repeat(extra="n"), "close tab [<n>]": R(Key("c-f4/20"), rdescript="SSMS: Close Tab") * Repeat(extra="n"), "go to line": R(Key("c-g"), rdescript="SSMS: Go To Line"), "comment line": R(Key("c-k, c-c"), rdescript="SSMS: Comment Selection"), "comment block": R(Key("c-k, c-c"), rdescript="SSMS: Comment Block"), "(un | on) comment line": R(Key("c-k/50, c-u"), rdescript="SSMS: Uncomment Selection"), "(un | on) comment block": R(Key("c-k/50, c-u"), rdescript="SSMS: Uncomment Block"), "[toggle] full screen": R(Key("sa-enter"), rdescript="SSMS: Fullscreen"), "(set | toggle) bookmark": R(Key("c-k, c-k"), rdescript="SSMS: Toggle Bookmark"), "next bookmark": R(Key("c-k, c-n"), rdescript="SSMS: Next Bookmark"), "prior bookmark": R(Key("c-k, c-p"), rdescript="SSMS: Previous Bookmark"), "[toggle] breakpoint": R(Key("f9"), rdescript="SSMS: Breakpoint"), "step over [<n>]": R(Key("f10/50") * Repeat(extra="n"), rdescript="SSMS: Step Over"), "step into": R(Key("f11"), rdescript="SSMS: Step Into"), "step out [of]": R(Key("s-f11"), rdescript="SSMS: Step Out"), "resume": R(Key("f5"), rdescript="SSMS: Resume"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class FileDialogueRule(MappingRule): mapping = { "up [<n>]": R(Key("a-up")) * Repeat(extra="n"), "back [<n>]": R(Key("a-left")) * Repeat(extra="n"), "forward [<n>]": R(Key("a-right")) * Repeat(extra="n"), "search [<text>]": R(Key("c-l, tab") + Text("%(text)s")), "organize": R(Key("c-l, tab:2")), "(left | navigation) pane": R(Key("c-l, tab:3")), "(center|file|files|folder) (list | pane)": R(Key("c-l, tab:4")), "sort [headings]": R(Key("c-l, tab:5")), "[file] name": R(Key("a-n")), "file type": R(Key("c-l, tab:7")), } extras = [ShortIntegerRef("n", 1, 10), Dictation("text")] defaults = { "n": 1, }
class IERule(MergeRule): pronunciation = "explorer" mapping = { "get up [<n>]": R(Key("a-up")) * Repeat(extra="n"), "get back [<n>]": R(Key("a-left")) * Repeat(extra="n"), "get forward [<n>]": R(Key("a-right")) * Repeat(extra="n"), "new folder": R(Key("cs-n")), "address bar": R(Key("c-l")), "search": R(Key("c-l, tab")), "left pane": R(Key("c-l, tab:2")), "center pane": R(Key("c-l, tab:3")), "sort": R(Key("c-l, tab:4")), } extras = [IntegerRefST("n", 1, 10)] defaults = { "n": 1, }
class MineNon(MappingRule): mapping = { # "switch <exec_path>": # R(Function(window_switcher.switch_window)), # "switch notepad": # R(Playback([(["switch", "to", "notepad"], 0.0)])), # "switch kindle": # R(Playback([(["switch", "to", "kindle"], 0.0)])), # "switch spot if I": # R(Playback([(["switch", "to", "spotify"], 0.0)])), # "switch file man": # R(Playback([(["switch", "to", "fman"], 0.0)])), # "open spot if I": # R(Playback([(["open", "spotify"], 0.0)])), # "open file man": # R(Playback([(["open", "fman"], 0.0)])), "show work [spaces]": R(Key("w-tab")), "(create | new) work [space]": R(Key("wc-d")), "close work [space]": R(Key("wc-f4")), "next work [space] [<n>]": R(Key("wc-right")) * Repeat(extra="n"), "(previous | prior) work [space] [<n>]": R(Key("wc-left")) * Repeat(extra="n"), # "normal mode": # R(Playback([(["switch", "to", "normal", "mode"], 0.0)])), # "command mode": # R(Playback([(["switch", "to", "command", "mode"], 0.0)])), # "dictation mode": # R(Playback([(["switch", "to", "dictation", "mode"], 0.0)])), } extras = [ window_switcher.get_choice(), IntegerRefST("n", 1, 5), ] defaults = { "n": 1, }
class VisualStudioRule(MergeRule): pronunciation = "visual studio" mapping = { "next tab [<n>]": R(Key("ca-pgdown"), rdescript="Visual Studio: Next Tab") * Repeat(extra="n"), "prior tab [<n>]": R(Key("ca-pgup"), rdescript="Visual Studio: Previous Tab") * Repeat(extra="n"), "close tab [<n>]": R(Key("c-f4/20"), rdescript="Visual Studio: Close Tab") * Repeat(extra="n"), "(list | show) documents": R(Key("a-w, w"), rdescript="Visual Studio: List Documents"), "[focus] document (window | pane)": R(Key("a-w, w, enter"), rdescript="Visual Studio: Focus Document Pane"), "solution explorer": R(Key("ca-l"), rdescript="Visual Studio: Solution Explorer"), "team explorer": R(Key("c-backslash, c-m"), rdescript="Visual Studio: Team Explorer"), "source control explorer": R(Key("c-q") + Text("Source Control Explorer") + Key("enter"), rdescript="Visual Studio: Source Control Explorer"), "quick launch": R(Key("c-q"), rdescript="Visual Studio: Quick Launch"), "go to line": R(Key("c-g"), rdescript="Visual Studio: Go To Line"), "comment line": R(Key("c-k, c-c"), rdescript="Visual Studio: Comment Selection"), "comment block": R(Key("c-k, c-c"), rdescript="Visual Studio: Comment Block"), "(un | on) comment line": R(Key("c-k/50, c-u"), rdescript="Visual Studio: Uncomment Selection"), "(un | on) comment block": R(Key("c-k/50, c-u"), rdescript="Visual Studio: Uncomment Block"), "[toggle] full screen": R(Key("sa-enter"), rdescript="Visual Studio: Fullscreen"), "(set | toggle) bookmark": R(Key("c-k, c-k"), rdescript="Visual Studio: Toggle Bookmark"), "next bookmark": R(Key("c-k, c-n"), rdescript="Visual Studio: Next Bookmark"), "prior bookmark": R(Key("c-k, c-p"), rdescript="Visual Studio: Previous Bookmark"), "collapse to definitions": R(Key("c-m, c-o"), rdescript="Visual Studio: Collapse To Definitions"), "toggle [section] outlining": R(Key("c-m, c-m"), rdescript="Visual Studio: Toggle Section Outlining"), "toggle all outlining": R(Key("c-m, c-l"), rdescript="Visual Studio: Toggle All Outlining"), "[toggle] breakpoint": R(Key("f9"), rdescript="Visual Studio: Breakpoint"), "step over [<n>]": R(Key("f10/50") * Repeat(extra="n"), rdescript="Visual Studio: Step Over"), "step into": R(Key("f11"), rdescript="Visual Studio: Step Into"), "step out [of]": R(Key("s-f11"), rdescript="Visual Studio: Step Out"), "resume": R(Key("f5"), rdescript="Visual Studio: Resume"), "run tests": R(Key("c-r, t"), rdescript="Visual Studio: Run test(s)"), "run all tests": R(Key("c-r, a"), rdescript="Visual Studio: Run all tests"), "build solution": R(Key("cs-b"), rdescript="Visual Studio: Build solution"), "get latest [version]": R(Key("a-f, r, l"), rdescript="Visual Studio: Get Latest"), "(show | view) history": R(Key("a-f, r, h"), rdescript="Visual Studio: Show History"), "compare (files | versions)": R(Key("a-f, r, h"), rdescript="Visual Studio: Compare..."), "undo (checkout | pending changes)": R(Key("a-f, r, u"), rdescript="Visual Studio: Undo Pending Changes"), "[open] [go to] work item": R(Key("a-m, g"), rdescript="Visual Studio: Open Work Item"), "[add] [new] linked work item": R(Key("sa-l"), rdescript="Visual Studio: New Linked Work Item"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim":""}
class FoxitRule(MergeRule): pronunciation = "fox it reader" mapping = { "next tab [<n>]": R(Key("c-tab"), rdescript="Foxit Reader: Next Tab") * Repeat(extra="n"), "prior tab [<n>]": R(Key("cs-tab"), rdescript="Foxit Reader: Previous Tab") * Repeat(extra="n"), "close tab [<n>]": R(Key("c-f4/20"), rdescript="Foxit Reader: Close Tab") * Repeat(extra="n"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class FileDialogueRule(MergeRule): pronunciation = "file dialogue" mapping = { "get up [<n>]": R(Key("a-up")) * Repeat(extra="n"), "get back [<n>]": R(Key("a-left")) * Repeat(extra="n"), "get forward [<n>]": R(Key("a-right")) * Repeat(extra="n"), "new folder": R(Key("cs-n")), "address bar": R(Key("c-l")), "search": R(Key("c-l, tab")), "left pane": R(Key("c-l, tab:3")), "center pane": R(Key("c-l, tab:4")), "sort": R(Key("c-l, tab:5")), "organize": R(Key("c-l, tab:2")), "(dateiname | filename)": R(Key("c-l, tab:6")), "(dateityp | file type)": R(Key("c-l, tab:7")), } extras = [IntegerRefST("n", 1, 10)] defaults = { "n": 1, }
def test_core_commands(): Breathe.add_commands( None, { "test one": DoNothing(), "test two": DoNothing(), "test three": DoNothing(), "banana [<n>]": DoNothing() * Repeat("n"), }, [IntegerRef("n", 1, 10, 1)], ) engine.mimic(["test", "three", "test", "two", "banana", "five"])
class MSVCRule(MergeRule): pronunciation = "Microsoft visual studio" mapping = { "cursor prior": R(Key("c-minus"), rdescript="MSVC: Cursor Prior"), "cursor next": R(Key("cs-minus"), rdescript="MSVC: Cursor Next"), "toggle fullscreen": R(Key("sa-enter"), rdescript="MSVC: Toggle Fullscreen"), "resolve": R(Key("c-dot"), rdescript="MSVC: Resolve"), "jump to source": R(Key("f12"), rdescript="MSVC: Jump To Source"), "snippet": R(Key("tab"), rdescript="MSVC: Snippet"), "step over [<n>]": R(Key("f10/50") * Repeat(extra="n"), rdescript="MSVC: Step Over"), "step into": R(Key("f11"), rdescript="MSVC: Step Into"), "step out [of]": R(Key("s-f11"), rdescript="MSVC: Step Out"), "resume": R(Key("f8"), rdescript="MSVC: Resume"), "build [last]": R(Key("ca-f7"), rdescript="MSVC: Build"), "debug [last]": R(Key("f5"), rdescript="MSVC: Debug"), "comment out": R(Key("c-k/50, c-c"), rdescript="MSVC: Comment Out"), "on comment out": R(Key("c-k/50, c-u"), rdescript="MSVC: Uncomment Out"), "set bookmark": R(Key("c-k, c-k"), rdescript="MSVC: Set Bookmark"), "next bookmark": R(Key("c-k, c-n"), rdescript="MSVC: Next Bookmark"), "breakpoint": R(Key("f9"), rdescript="MSVC: Breakpoint"), "format code": R(Key("cs-f"), rdescript="MSVC: Format Code"), "(do imports | import all)": R(Key("cs-o"), rdescript="MSVC: Do Imports"), "comment line": R(Key("c-slash"), rdescript="MSVC: Comment Line"), "go to line": R(Key("c-g"), rdescript="MSVC: Go To Line"), } extras = [ Dictation("text"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1}
class GlobalRule(MappingRule): mapping = { '[<text>] go to sleep': Function(go_to_sleep), 'mouse': Key('f3,f4/350,f4'), "touch": Mouse("left"), "touch two": Mouse("left:2"), 'touch are': Mouse('right'), "touch mid": Mouse("middle"), "[<n>] scroll down": (Mouse("wheeldown") + Pause('5')) * Repeat(extra='n') * 2, "[<n>] scroll up": (Mouse("wheelup") + Pause('5')) * Repeat(extra='n') * 2, "[<n>] scroll right": (Mouse("wheelright") + Pause('5')) * Repeat(extra='n') * 2, "[<n>] scroll left": (Mouse("wheelleft") + Pause('5')) * Repeat(extra='n') * 2, "drag": Mouse("left:down"), "drop": Mouse("left:up"), "[<n>] alt tab": Key("alt:down,tab/50:%(n)d/50,alt:up"), "alt tab show": Key("alt:down,tab/10,s-tab"), 'reload natlink': Function(reload_natlink), } extras = [ IntegerRef('n', 1, 101, default=1), Dictation('text'), ]
def test_top_level_command_failure(): Breathe.add_commands( AppContext("china"), { "not marked top level <sequence1> and <sequence2> [<n>]": DoNothing() + Exec("sequence1") + DoNothing() + Exec("sequence2")* Repeat("n") }, extras=[CommandsRef("sequence1"), CommandsRef("sequence2", 2), IntegerRef("n", 1, 10, 1)], top_level=False, ) assert len(Breathe.top_level_commands) == 2
class FirefoxRule(MergeRule): pronunciation = "fire fox" mapping = { "new tab [<n>]": R(Key("c-t"), rdescript="Browser: New Tab") * Repeat(extra="n"), "reopen tab [<n>]": R(Key("cs-t"), rdescript="Browser: Reopen Tab") * Repeat(extra="n"), "show history": R(Key("c-h"), rdescript="Browser: Show History"), "show downloads": R(Key("c-j"), rdescript="Browser: Show Downloads"), "zoom in <n>": R(Key("c-plus/20"), rdescript="Browser: Zoom In") * Repeat(extra="n"), "zoom out <n>": R(Key("c-minus/20"), rdescript="Browser: Zoom") * Repeat(extra="n"), "super refresh": R(Key("c-f5"), rdescript="Browser: Super Refresh"), "[add] bookmark": R(Key("c-d"), rdescript="Browser: Add Bookmark"), "developer tools": R(Key("f12"), rdescript="Browser: Developer Tools"), "resume": R(Key("f8"), rdescript="Browser: Resume"), "step over": R(Key("f10"), rdescript="Browser: Step Over"), "step into": R(Key("f11"), rdescript="Browser: Step Into"), "step out": R(Key("s-f11"), rdescript="Browser: Step Out"), "IRC identify": R(Text("/msg NickServ identify PASSWORD"), rdescript="IRC Chat Channel Identify"), } extras = [ Dictation("dict"), IntegerRefST("n", 1, 100), ] defaults = {"n": 1, "dict": "nothing"}
class ChromeRule(MappingRule): _mapping = { browser_shared.PREVIOUS_TAB_N_TIMES: R(Key("cs-tab")) * Repeat(extra="n"), browser_shared.SWITCH_TO_TAB_N: R(Key("c-%(m)s%(nth)s")), browser_shared.SWITCH_TO_LAST_TAB: R(Key("c-9")), browser_shared.SWITCH_TO_SECOND_TO_LAST_TAB: R(Key("c-9, cs-tab")), "switch focus [<n>]": R(Key("f6/20")) * Repeat(extra="n"), browser_shared.TOGGLE_BOOKMARK_TOOLBAR: R(Key("cs-b")), "switch user": R(Key("cs-m")), "focus notification": R(Key("a-n")), "allow notification": R(Key("as-a")), "deny notification": R(Key("as-a")), "google that": R(Store(remove_cr=True) + Key("c-t") + Retrieve() + Key("enter")), "wikipedia that": R( Store(space="+", remove_cr=True) + Key("c-t") + Text("https://en.wikipedia.org/w/index.php?search=") + Retrieve() + Key("enter")), browser_shared.SHOW_EXTENSIONS: R(Key("a-f/20, l, e/15, enter")), "more tools": R(Key("a-f/5, l")), } mapping = BrowserSharedCommands.merge_dictionaries( _mapping, BrowserSharedCommands.chromeAndFirefoxMapping) extras = browser_shared.get_extras() defaults = browser_shared.get_defaults()
class Punctuation(MergeRule): pronunciation = CCRMerger.CORE[3] mapping = { "[<long>] <text_punc> [<npunc>]": R(Text("%(long)s" + "%(text_punc)s" + "%(long)s")) * Repeat(extra="npunc"), # For some reason, this one doesn't work through the other function "[<long>] backslash [<npunc>]": R(Text("%(long)s" + "\\" + "%(long)s")) * Repeat(extra="npunc"), } extras = [ IntegerRefST("npunc", 0, 10), Choice("long", { "long": " ", }), Choice("text_punc", text_punc_dict) ] defaults = { "npunc": 1, "long": "", }
class FileDialogueRule(MergeRule): pronunciation = "file dialogue" mapping = { "[get] up [<n>]": R(Key("a-up"), rdescript="File Dialogue: Navigate up") * Repeat(extra="n"), "[get] back [<n>]": R(Key("a-left"), rdescript="File Dialogue: Navigate back") * Repeat(extra="n"), "[get] forward [<n>]": R(Key("a-right"), rdescript="File Dialogue: Navigate forward") * Repeat(extra="n"), "(files | file list)": R(Key("a-d, f6:3"), rdescript="File Dialogue: Files list"), "navigation [pane]": R(Key("a-d, f6:2"), rdescript="File Dialogue: Navigation pane"), "[file] name": R(Key("a-d, f6:5"), rdescript="File Dialogue: File name"), } extras = [IntegerRefST("n", 1, 10)] defaults = { "n": 1, }