From 2c832d09b3832d7fb829132f9e09daddbedbb2eb Mon Sep 17 00:00:00 2001 From: Ian Markind Date: Wed, 22 Aug 2018 02:06:07 -0400 Subject: [PATCH] added commands for youtube, visual studio code, and php snippets for phpstorm --- google-chrome.py | 48 +++++++++++++++++++++++++++++++++++++----------- jetbrains.py | 4 ++-- php-storm.py | 18 ++++++++++++++---- std.py | 14 +++++++++++--- vs-code.py | 5 ++++- 5 files changed, 68 insertions(+), 21 deletions(-) diff --git a/google-chrome.py b/google-chrome.py index 270205a..d444017 100644 --- a/google-chrome.py +++ b/google-chrome.py @@ -40,10 +40,6 @@ def search(m): press('cmd-m') -def quit(m): - press('cmd-q') - - def scroll_to_top(m): press('g') press('g') @@ -58,7 +54,7 @@ def refocus_page(m): focus_address_bar(None) # Escape button - # This leaves the focus on the page at previous tab focused point, not the beginning of the page + # This leaves the focus on the page at previous tab focused point, not t_he beginning of the page press('escape') @@ -83,14 +79,45 @@ def jump_tab(m): 'search': search, 'print': print_page, 'top': scroll_to_top, - 'quit': quit, + + # youtube + # disable vimium for youtube shortcuts to work + '(play | pause)': Key('k'), + 'movie mode': Key('f'), + '[toggle] theater mode': Key('t'), + 'restart video': Key('home'), + 'end video': Key('end'), + 'volume down': Key('down'), + 'volume up': Key('up'), + '(mute | unmute)': Key('m'), + 'video search': Key('/'), + 'slow down': Key('<'), + 'speed up': Key('>'), + '(jump | forward) ten': Key('l'), + '(jump | forward) five': Key('right'), + 'back ten': Key('j'), + 'back five': Key('left'), + + # not working + 'previous video': Key('P'), + 'next video': Key('shift-n'), + '(toggle captions | toggle caption)': Key('c'), 'back[ward]': back, 'forward': forward, 'reload': Key('cmd-r'), 'hard reload': Key('cmd-shift-r'), + 'bookmark': Key('cmd-d'), + 'toggle bookmark [bar]': Key('cmd-shift-b'), + 'bookmark manager': Key('cmd-alt-b'), + 'downloads': Key('cmd-shift-j'), + 'add extras': Key('ctrl-enter'), + 'add extras new': Key('ctrl-shift-enter'), 'new tab': Key('cmd-t'), + 'new window': Key('cmd-n'), + 'close window': Key('cmd-shift-w'), + '(incognito | incog)': Key('cmd-shift-n'), 'close tab': Key('cmd-w'), '(reopen | unclose) tab': Key('cmd-shift-t'), @@ -101,13 +128,15 @@ def jump_tab(m): '(end | rightmost) tab': Key('cmd-9'), 'find': Key('cmd-f'), - 'next': Key('cmd-g'), - + 'next match': Key('cmd-g'), '(last | prevous)': Key('cmd-shift-g'), + 'clear cash': Key('cmd-shift-backspace'), + # dev tools 'toggle dev tools': Key('cmd-alt-i'), 'command [menu]': Key('cmd-shift-p'), + '(javascript (counsel | console) | javascript (counsel | console) close)': Key('cmd-alt-j'), 'next panel': next_panel, '(last | prevous) panel': last_panel, '[show] application [panel]': lambda m: show_panel('Application'), @@ -124,8 +153,5 @@ def jump_tab(m): '[refocus] dev tools': open_focus_devtools, # Clipboard - 'cut': Key('cmd-x'), - 'copy': Key('cmd-c'), - 'paste': Key('cmd-v'), 'paste same style': Key('cmd-alt-shift-v'), }) diff --git a/jetbrains.py b/jetbrains.py index 0b4313c..2f95f31 100644 --- a/jetbrains.py +++ b/jetbrains.py @@ -1,6 +1,6 @@ from talon.voice import Context, Key -ides = { +ides = [ "com.jetbrains.intellij", "com.jetbrains.intellij.ce", "com.jetbrains.AppCode", @@ -13,7 +13,7 @@ "com.jetbrains.rubymine", "com.jetbrains.WebStorm", "com.google.android.studio", -} +] ctx = Context('phpstorm', func=lambda app, win: any( diff --git a/php-storm.py b/php-storm.py index 67ff5fd..f1009a1 100644 --- a/php-storm.py +++ b/php-storm.py @@ -1,20 +1,30 @@ from talon.voice import Context, Key -ides = { +ides = [ "com.jetbrains.PhpStorm", -} +] ctx = Context('phpstorm', func=lambda app, win: any( i in app.bundle for i in ides)) keymap = { - '(phiz | fizz)': ['php', Key('tab')], + '(flip | phiz | fizz)': ['php', Key('tab')], + 'party': ['phps', Key('tab')], + '(start flip | start phiz | start fizz)': ' ', # 'search': [Key('shift'), Key('shift')], 'golf': ['fore', Key('tab')], + 'horse': ['for', Key('tab')], + 'horse markup': ['formk', Key('tab')], 'chop': ['forek', Key('tab')], - 'bat': ['?=', Key('tab')], + 'eagles': ['?=', Key('tab')], 'if': ['if', Key('tab')], + 'if markup': ['ifm', Key('tab')], + 'else if': ['elif', Key('tab')], + 'else if markup': ['elifm', Key('tab')], + 'else': ['else', Key('tab')], + 'else markup': ['elsem', Key('tab')], 'complete': Key('cmd-shift-enter'), 'definition': Key('alt-space'), } diff --git a/std.py b/std.py index c889991..fa25b6c 100644 --- a/std.py +++ b/std.py @@ -101,7 +101,7 @@ def rot13(i, word, _): 'snake': (True, lambda i, word, _: word if i == 0 else '_'+word), 'smash': (True, lambda i, word, _: word), # spinal or kebab? - 'kebab': (True, lambda i, word, _: word if i == 0 else '-'+word), + 'truck': (True, lambda i, word, _: word if i == 0 else '-'+word), # 'sentence': (False, lambda i, word, _: word.capitalize() if i == 0 else word), 'title': (False, lambda i, word, _: word.capitalize()), 'allcaps': (False, lambda i, word, _: word.upper()), @@ -196,6 +196,10 @@ def FormatText(m): 'new folder': Key('shift-cmd-n'), '(settings | preferences)': Key('cmd-,'), 'trash': Key('cmd-delete'), + '(show desktop | toggle desktop | hide desktop)': Key('f11'), + 'windows mode': Key('ctrl-down'), + 'reverse': Key('tab'), + 'advance': Key('`'), # Finder 'documents': Key('shift-cmd-o'), @@ -217,8 +221,8 @@ def FormatText(m): 'start': Key('cmd-left'), 'end': Key('cmd-right'), '(top | go to top)': Key('cmd-up'), - 'flip': Key('fn-up'), - 'flop': Key('fn-down'), + 'page up': Key('pageup'), + 'page down': Key('pagedown'), 'jump [right] word': Key('alt-right'), 'jump left word': Key('alt-left'), @@ -289,6 +293,10 @@ def FormatText(m): 'run (them | vim)': 'vim ', 'run L S': 'ls\n', 'dot pie': '.py', + 'dot Jay Es': '.js', + 'dot Sea EsEs': '.css', + '(dot flip | dot P H P)': '.php', + '(dot sass | dot sassy)': '.scss', 'run make': 'make\n', 'run jobs': 'jobs\n', diff --git a/vs-code.py b/vs-code.py index be6280a..cb7b8fd 100644 --- a/vs-code.py +++ b/vs-code.py @@ -40,7 +40,7 @@ def jump_to_next_word_instance(m): # Navigating text 'pizza (0 | oh | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)+': jump_to_line, - + '[toggle] terminal': Key('alt-f12'), # Selecting text 'select line': Key('cmd-right cmd-shift-left'), @@ -56,5 +56,8 @@ def jump_to_next_word_instance(m): '(previous | last)': Key('cmd-shift-g'), 'find next ': jump_to_next_word_instance, + '(dupe | duplicate)': Key('cmd-d'), + + }) \ No newline at end of file