title: Keyboard shortcut to switch between the code editor and ipython console using the Canopy
body: <p>How can I create a keyboard shortcut to switch between the code editor and ipython console using the Canopy IDE?</p>
  
  <p>I have tried writing a macro according to the documentation for code editing (<a href="http://docs.enthought.com/canopy/configure/editor-scripting-api.html#code-editor-scripting-commands" rel="nofollow">http://docs.enthought.com/canopy/configure/editor-scripting-api.html#code-editor-scripting-commands</a>) and the ipython pane scripting commands (<a href="http://docs.enthought.com/canopy/configure/ipython-scripting-api.html#ipython-pane-scripting-commands" rel="nofollow">http://docs.enthought.com/canopy/configure/ipython-scripting-api.html#ipython-pane-scripting-commands</a>, but do not see a solution.  </p>
  
  <p>As an example, I have a macro that will execute the current line of code (without having to select it), but it would be nice to be able to switch the cursor back to the code editor after execution without touching the mouse/trackpad.</p>
  
  <pre><code>def run():
      code_task = get_active_task()
      code_editor = code_task.active_editor
      cursor = code_editor.cursor
      cursor.start_of_line()
      cursor.next_line(select=True)
      code_task.run_selection()
  </code></pre>
  
  <p>Using Canopy Version: 1.1.1 (64 bit) on Mac OS X 10.7.5</p>