Ctrl-m keyboard shortcut clash on Chrome OS #2678

Closed
hennievn opened this Issue Dec 14, 2012 · 19 comments

Comments

Projects
None yet
9 participants

Google Chromebooks uses the Ctrl-m keyboard shortcut to bring up the file manager. A key binding other than Ctrl-m will need to be used on this OS in order to utilize the HTML Notebook keyboard shortcuts.

One alternative I've tried is Ctrl-i as this is not used by the OS. This appears to be achievable with minor changes (beware: non-expert opinion) with only small changes needed to notebook.js and quickhelp.js to detect this non-standard case.

notebook.js:

    Notebook.prototype.bind_events = function () {
        var that = this;
        var ctrlKey = 77
        if (navigator.appVersion.indexOf('CrOS') != -1) {
            ctrlKey = 73
        }   

quickhelp.js:

    //var meta_key = $('body').data('notebookMetaKey')
        //var meta_key_string = 'Ctrl-' + meta_key

        var ctrlKey = 'Ctrl-m'
        if (navigator.appVersion.indexOf('CrOS') != -1) {
            ctrlKey = 'Ctrl-i'
        }   
        var dialog = $('<div/>');
        this.shortcut_dialog = dialog;
        var shortcuts = [
            {key: 'Shift-Enter', help: 'run cell'},
            {key: 'Ctrl-Enter', help: 'run cell in-place'},
            {key: ctrlKey + ' x', help: 'cut cell'},
            {key: ctrlKey + ' c', help: 'copy cell'},
Owner

ellisonbg commented Dec 14, 2012

Aww, crap, maybe Google would change their mind for us :) Do we want to change it for all platforms? Is Ctrl-i the best option?

Google certainly does not leave a lot of options open, assuming you want to use a Ctrl-key combination. It looks as if the only unassigned Ctrl- combinations are Ctrl-i, b, y....

Below is the various two-key-sequence Ctrl-xx keys already assigned on CrOS. There are many more in the form of Ctrl-Shift-xx, etc.

  • Ctrl+N Open a new window
  • Ctrl+T Open a new tab
  • Ctrl+O Open a file in the browser
  • Ctrl+W Close the current tab
  • Ctrl+1 through Ctrl+8 Go to the tab at the specified position in the window
  • Ctrl+9 Go to the last tab in the window
  • Ctrl+Tab Go to the next tab in the window
  • Ctrl+P Print your current page
  • Ctrl+S Save your current page
  • Ctrl+R Reload your current page
  • Ctrl and + Zoom in on the page
  • Ctrl and - Zoom out on the page
  • Ctrl+0 Reset zoom level
  • Ctrl+D Save your current webpage as a bookmark
  • Ctrl+F Open the find bar to search your current page
  • Ctrl+G or Enter Go to the next match for your input in the find bar
  • Ctrl+K or Ctrl+E Perform a search. Type a search term after the question mark in the address bar and press Enter.
  • Ctrl+Enter Add www. and .com to your input in the address bar and open the resulting URL
  • Ctrl+ Take a screenshot of your current page
  • Ctrl+ Shift+ Take a partial screenshot
  • Ctrl+U View page source
  • Ctrl+M Open the Files app
  • Ctrl+. Display hidden files in the Files app
  • Ctrl+H Open the History page
  • Ctrl+J Open the Downloads page
  • Ctrl+? Go to the Help Center
  • Ctrl+ Configure monitor display
  • Ctrl + or Ctrl + Switches focus to the next keyboard-accessible pane. Panes include:
  • Ctrl+A Select everything on the page
  • Ctrl+L or Alt+D Select the content in the address bar
  • Press Ctrl and right arrow Move to the end of the next word
  • Press Ctrl and left arrow Move to the start of the previous word
  • Ctrl+C Copy selected content to the clipboard
  • Ctrl+V Paste content from the clipboard
  • Ctrl+X Cut
  • Ctrl+Backspace Delete the previous word
  • Ctrl+Z Undo your last action

hennievn closed this Dec 14, 2012

hennievn reopened this Dec 14, 2012

Owner

ellisonbg commented Dec 14, 2012

Awesome, thanks for searching through the available ones and I think that Ctrl-i is the best of them. What about using a different modifier like meta? I am wondering if alt-m is available...

Yes you will have better luck with Alt-m, For the alpha keys, I see only Alt-e,d,f being used by CrOS.

Owner

ellisonbg commented Dec 15, 2012

I think Alt-m would be best, any other input on this one?

On Fri, Dec 14, 2012 at 11:41 AM, hennievn notifications@github.com wrote:

Yes you will have better luck with Alt-m, For the alpha keys, I see only
Alt-e,d,f being used by CrOS.


Reply to this email directly or view it on GitHubhttps://github.com/ipython/ipython/issues/2678#issuecomment-11389379.

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

Owner

takluyver commented Dec 15, 2012

Are we talking about changing the default shortcut we use on all platforms, detecting Chrome OS to provide a different shortcut combination, or providing an additional shortcut combination as well as the one we already have?

Owner

Carreau commented Dec 15, 2012

I think this issue should go under "make keyboard shortcut configurable".

Owner

ellisonbg commented Dec 15, 2012

Do you mean make the Ctrl-m part configurable or make every last one of our
keyboard shortcuts configurable?

On Sat, Dec 15, 2012 at 10:45 AM, Bussonnier Matthias <
notifications@github.com> wrote:

I think this issue should go under "make keyboard shortcut configurable".


Reply to this email directly or view it on GitHubhttps://github.com/ipython/ipython/issues/2678#issuecomment-11408690.

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

Owner

Carreau commented Dec 15, 2012

Both.
I don't think there is a (such) a big difference.

If the configuration is smart enough you could be able to chose the binding you want.
And even maybe N namespaces.

Obviously the Ctrl+m part is faster to do.

One of the limiting part beeing of course, bring the configuration to the browser side.

Owner

ellisonbg commented Dec 15, 2012

But what about the following: for every 100 ways the keyboard shortcuts can
be configured, 99 of them will be broken and conflict with different
OS/browser combinations. I think that this type of configurability will
only generate lots of issues that we can't fix. I do think we will want
some sort of "guided" configurability for the keyboard short cuts that
allows users some customization, but makes sure they won't break things.

On Sat, Dec 15, 2012 at 11:42 AM, Bussonnier Matthias <
notifications@github.com> wrote:

Both.
I don't think there is a (such) a big difference.

If the configuration is smart enough you could be able to chose the
binding you want.
And even maybe N namespaces.

Obviously the Ctrl+m part is faster to do.

One of the limiting part beeing of course, bring the configuration to the
browser side.


Reply to this email directly or view it on GitHubhttps://github.com/ipython/ipython/issues/2678#issuecomment-11409401.

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

Owner

Carreau commented Dec 15, 2012

But what about the following: for every 100 ways the keyboard shortcuts can
be configured, 99 of them will be broken and conflict with different
OS/browser combinations.

I totally agree, but it should be easy to move different action between working shortcut.
we actually don't care what C-M,h does it just trigger an action (which right now is show help) , but it could be swith to haskel kernel...

What I mean by configurability is :

  • on one side shortcut that works.
  • on the other actions

You provide a default map, but this map could be changed.

I know there are soem edge case with some actions that will be out of scope like tooltip/tab completion.
But I still call that configurability, and I guess in those software people have complain that binding to Ctrl+Alt+Sup was not working on windows.

Having easy configurability would also allow smart detection of browser/os to provide different default shortcut map as plugin for example.

robbyki commented Feb 18, 2014

Trying to change this desparately to ctrl-i instead of ctrl-m for all of our stations at work since they are all chrome os. Can I trouble someone to describe where and how to add the custom js files above (notebook.js and quickhelp.js) to make this work?

Owner

Carreau commented Feb 18, 2014

you will not be able to have this through custom js on 1.x you will ave to patch the source here at least (77== 'm' )

Owner

ellisonbg commented Feb 18, 2014

In IPython master (and upcomong 2.0) this is much easier. It is something
like this:

IPython.keyboard_manager.edit_shortcuts.remove_shortcut('ctrl+m')

On Tue, Feb 18, 2014 at 8:18 AM, Matthias Bussonnier <
notifications@github.com> wrote:

you will not be able to have this through custom js on 1.x you will ave to
patch the source herehttps://github.com/ipython/ipython/blob/rel-1.1.0/IPython/html/static/notebook/js/notebook.js#L182at least (77== 'm' )

Reply to this email directly or view it on GitHubhttps://github.com/ipython/ipython/issues/2678#issuecomment-35401021
.

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

robbyki commented Feb 18, 2014

Just transitioned over to 2.0 and using command mode. Exactly what I wanted and simply incredible.

@minrk minrk modified the milestone: 2.0, wishlist Feb 18, 2014

minrk closed this Feb 18, 2014

I can't use keyboard shortcuts when running in Chome browser on Ubuntu 14.04 (Chrome ver 36.0.1985.125).

Is this issue related? Any workaround to get keyboard shortcuts working in Chrome / Ubunty?

Note keyboard shortcuts do work on Firefox (version 31.0)

Contributor

dsblank commented Aug 13, 2014

@stevelorimer I just updated Chrome to the same version on Ubuntu 14.04, and keyboard shortcuts seem to work for me. Which ones fail? Have you tried rebooting?

I'm using the repo version of IPython - which is 1.2.1 - perhaps that's the problem

Anything starting with Ctrl-m is failing

@stevelorimer I've been seeing the same thing with ipython 1.x and latest chromium. Tracked it down to https://code.google.com/p/chromium/issues/detail?id=368100

If you have access to the source then at https://github.com/ipython/ipython/blob/rel-1.1.0/IPython/html/static/notebook/js/notebook.js#L324

            } else if (event.which !== 229 && that.control_key_active) { /* work around a chromium issue */

fixes the problem for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment