Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shift+escape broken in latest Firefox and chrome #73

Closed
petergthatsme opened this issue Dec 20, 2022 · 20 comments · Fixed by #100 or #133
Closed

shift+escape broken in latest Firefox and chrome #73

petergthatsme opened this issue Dec 20, 2022 · 20 comments · Fixed by #100 or #133
Labels
bug Something isn't working

Comments

@petergthatsme
Copy link

petergthatsme commented Dec 20, 2022

The latest Firefox (>= 108.0) implements a new functionality where shift+escape now brings up their process manager. This breaks jupyterlab-vim (i.e. pressing one two many times, triggers Firefox's binding)

I commented on a bug report with them (see here: https://bugzilla.mozilla.org/show_bug.cgi?id=1806272) - it seems like this new "feature" also breaks how discord works. I am not sure if anything will be done about it from Mozilla's side, so hoping there is maybe an easy workaround directly in jupyterlab-vim?

thanks

@petergthatsme petergthatsme added the bug Something isn't working label Dec 20, 2022
@ianhi
Copy link
Collaborator

ianhi commented Dec 20, 2022

Thanks for reporting! It would be huge bummer if that is non-configurable as it would require retraining muscle memory.

Fortunately this is already configurable on our side. If you go to the json settings editor for keyboard shortcuts then you can define a new shortcut for leaving vim mode to go into notebook command mode. For example:

{"shortcuts":[
        {
            "args": {},
            "selector": ".jp-NotebookPanel[data-jp-vim-mode='true'] .jp-Notebook.jp-mod-editMode",
            "keys": ["Ctrl Escape"],
            "command":"notebook:enter-command-mode"
        }
    ]
}

will make Ctrl-Esc enter jupyter command mode

for reference the extension defines this here:

{
"selector": ".jp-NotebookPanel[data-jp-vim-mode='true'] .jp-Notebook.jp-mod-editMode",
"keys": ["Shift Escape"],
"command": "notebook:enter-command-mode"
},

@ianhi
Copy link
Collaborator

ianhi commented Dec 20, 2022

@petergthatsme
Copy link
Author

Thanks very much for your quick answer @ianhi.
Yeah, it would be great if the plugin could overwrite firefox's binding as shift+escape seems a bit more natural to me (muscle memory, i guess), but not clear if that's even possible, or if firefox fights tooth and nail to prevent that (i.e., potential security risk?)

In any case setting ctrl+escape as as you suggest, also works fine... thanks again, this "bug" can be closed.

Minor point: you have a typo in your code snippet: "Crtl Escape" should read "Ctrl Escape".

@ianhi
Copy link
Collaborator

ianhi commented Dec 20, 2022

Minor point: you have a typo in your code snippet: "Crtl Escape" should read "Ctrl Escape".

Thanks - fixed.

There is also the proposed using of Esc to do double duty: #70

@ianhi
Copy link
Collaborator

ianhi commented Dec 20, 2022

In fairness to firefox shift-esc may be a reasonably obscure keybinding to have chosen - https://xkcd.com/1172/

@firai
Copy link
Collaborator

firai commented Aug 1, 2023

@ianhi Since Shift+Esc is now the task/process manager shortcut for both Firefox and Chrome (I don't know when it was introduced in Chrome), I'm wondering if the default jupyterlab-vim shortcut for entering command mode should be changed to something else. Thoughts?

EDIT: Ctrl+Esc in Windows brings up the Start menu, so that doesn't seem like a good default either. The other combinations of Esc on Windows correspond to arrangement of windows. I'm out of ideas for now.

@ianhi
Copy link
Collaborator

ianhi commented Aug 1, 2023

Interestingly I've found in firefox that when im in normal mode shift-esc still works but if i hit it twice i end up in the task manager, But I agree that this has become untenable. I think that having esc also go from normal mode to jupyter command mode is probably the best solution. But I'd be curious what other users think?

The other combinations of Esc on Windows correspond to arrangement of windows. I'm out of ideas for now.

Given this I think we cannot use combos of esc, but I suspect esc will never be pre-empted by the browser.

pinging a few people who's names I've seen several times. Still a shame that there's no general way to query the community of users for this.

@mlucool @lukashergt @petergthatsme @banderlog

@ianhi ianhi changed the title shift+escape broken in latest Firefox shift+escape broken in latest Firefox and chrome Aug 1, 2023
@ianhi ianhi pinned this issue Aug 1, 2023
@banderlog
Copy link

Well, personally I see no problem here.
Shift-Esc still works, it calls browser Manager only on second press.
I never or rarely need to exit vim mode. Most f the times I just need to exit Insert mode with Esc. And I do not want it to be remapped by default ¯\_(ツ)_/¯

Please share, why you need to exit vim mode completely, I am curious

@lukashergt
Copy link

Well, I constantly switch between jupyter and vim mode, so I use Shift-Esc a lot. I'm glad it works, but I do wish I didn't need to constantly close the accidentally opened browser manager.

Since Shift-Esc works in vim mode, I wonder whether we could simply create a Shift-Esc command in jupyter mode that does nothing, which then might override the firefox/chrome command.

Please share, why you need to exit vim mode completely, I am curious

I navigate around the notebook in jupyter mode.

@ianhi
Copy link
Collaborator

ianhi commented Aug 3, 2023

Shift-Esc command in jupyter mode that does nothing, which then might override the firefox/chrome command.

oooh that sounds like it would plausibly fix things

@firai
Copy link
Collaborator

firai commented Aug 3, 2023

Shift-Esc command in jupyter mode that does nothing, which then might override the firefox/chrome command.

oooh that sounds like it would plausibly fix things

Confirmed that adding the command mode selector to the shortcut (see below) would override the task/process manager shortcut. It probably shouldn't be the default though.

        {
            "command": "notebook:enter-command-mode",
            "keys": [
                "Shift Escape"
            ],
            "selector": ".jp-Notebook.jp-mod-commandMode",
            "args": {},
        }

@ianhi
Copy link
Collaborator

ianhi commented Aug 3, 2023

It probably shouldn't be the default though.

Why not? Seems to me that this solves a problem popping up for lots of users and doesn't harm anything when not fixing that (aside from blockign the task-manager I guess)

@lukashergt
Copy link

lukashergt commented Aug 3, 2023

I would make it the default.

There have been wishes for firefox to make their shortcuts customisable to not interfere with other programs' shortcuts, but from their perspective I can see them saying: "If you want to use that shortcut for something else, you have the right to overwrite it." (which we have already done in vim mode...)

If people still want to access their browser manager, simply open a new tab and press Shift-Esc...

@petergthatsme
Copy link
Author

I also second the above comments - it would be great to have this workaround implemented as a default. As nicely pointed out by @lukashergt it would still be very straightforward to access the browser manager in a simple way with the shortcut that the firefox devs put in.

@ianhi
Copy link
Collaborator

ianhi commented Aug 3, 2023

PR #100 please give it a test: Binder

@ianhi ianhi closed this as completed in #100 Aug 3, 2023
@ianhi
Copy link
Collaborator

ianhi commented Aug 4, 2023

this is release in 4.0.2 on pypi and likely on conda-forge tomorrow

@banderlog
Copy link

btw, guys, how enter VIM mode back after I exit it? It looks like it left only inside cells

@lukashergt
Copy link

I'm not sure I understand, @banderlog. I use jupyter mode to navigate between cells. I then use Enter to enter a cell in vim mode. i gets you into insert mode. Esc gets you back to vim mode. Shift+Esc gets you back into jupyter mode.

@banderlog
Copy link

@lukashergt I am telling about state when vim bindings for Cut/Copy/Paste Cell work. Because I have weird situation when vim bindings inside cells work, but vim bindings for cell manipulation not(

@lukashergt
Copy link

Might be better to open an issue and be very specific about what doesn't work. I think what you are referring to is what I call jupyter mode, where I navigate between cells with j and k, center on a cell with zz, cut a cell with x, etc. Most vim bindings work for me, not sure which vim bindings you are talking about that don't work.

@firai firai unpinned this issue Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants