Zenmode keybinding?

164 views
Skip to first unread message

Eric Dill

unread,
Jan 12, 2016, 10:43:25 AM1/12/16
to Project Jupyter
Hi All,

So I just discovered the nbextensions project and I really like the zenmode extension.  I would
love it if there was a keybinding to turn on/off zenmode.  How would I go about making that happen?

Thanks for your help!

Best,

Eric

Thomas Kluyver

unread,
Jan 12, 2016, 10:55:25 AM1/12/16
to Project Jupyter
Best wishes,
Thomas

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/6679f05f-9c7f-4688-8d0e-45ac98a528c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric Dill

unread,
Jan 12, 2016, 12:07:12 PM1/12/16
to Project Jupyter
Hi Thomas,

Thank you for the quick reply and the pointer to the custom keyboard shortcuts.  With the link that you 
provided I can sufficiently pattern-match to determine that I need to change the line `IPython.notebook.execute_cell();` to something
like `IPython.extensions.zenmode.toggleZenMode()`.  However, as is probably evident at this point, I have very little experience
with Javascript and I do not understand where the functions defined by nbextensions end up in the namespace.  Would you be able
to help me understand where the functions defined by jupyter extensions end up? 

To be more specific; this is the function that I am looking for in the namsepace https://github.com/ipython-contrib/IPython-notebook-extensions/blob/master/nbextensions/styling/zenmode/main.js#L55.  After some reading, it seems that the dictionary returned by 
the function defined in `main.js` is "exporting" these functions somewhere.  How do I access those functions?

Thanks again for your help.

Best,

Eric

Thomas Kluyver

unread,
Jan 12, 2016, 12:18:29 PM1/12/16
to Project Jupyter
Hi Eric,

I think you should use require to load the module, something like this:

require(['nbextensions/zenmode/main'],
function(zenmode) {
   // You can use zenmode.toggleZenMode in here
});

Others are more familiar than me with the JS side of things, though.

Thomas

Reply all
Reply to author
Forward
0 new messages