Hyper: Ctrl-based shortcuts don't work on Linux

Created on 19 Jul 2016  路  34Comments  路  Source: vercel/hyper

In the menus, most shortcuts are listed using the ctrl key as the only modifier (likely an automatic artifact from macOS's cmd). Some examples:

  • Copy ctrl+c
  • Paste ctrl+v
  • Close tab ctrl+w
  • New tab ctrl+t

These shortcuts don't work, nor should they since they are essential shortcuts used within the shell. Copy and paste seem to work with the usual ctrl+shift+c/v, but I couldn't find working versions of any others in my few minutes of guessing.

help wanted Bug

Most helpful comment

On my Ubuntu 14.04:

Ctrl+Shift+N > Not working
Ctrl+Shift+T > Not working
Ctrl+Shift+W > Not working
Ctrl+Shift+Z > Not working
Ctrl+Shift+X > Doesn't cut, copy instead
Ctrl+Shift+Z > OK
Ctrl+Shift+V > OK
Ctrl+Shift+A > Not working
Ctrl+Shift+K > Kind working, it clears all the terminal (looks like a bug), but Ctrl+L is working just fine
Ctrl+R > Doesn't reload, it starts the reverse search instead (which is the right thing on Linux)
Ctrl+R > Same as Ctrl+R
Ctrl+Shift+I > Not working
Ctrl+0 > OK
Zoom in and Zoom out are working with Ctrl++ and Ctrl+-
Ctrl+Shift+U > Not working
Ctrl+Alt+Left > Not working
Ctrl+Alt+Right > Not working
F11 > Not working

All 34 comments

The default shortcuts for new tabs on Linux is Ctrl+Shift+T to open a new tab and Ctrl+Shift+W to close one. Currently Ctrl+w closes the entire app.

But the reason behind it not working is because of hterm binding all keyboard shortcuts for terminal input and probably preventsDefault() so the keyboard event is not bubbling down to electron. See app/lib/hterm.js:30

The problem is that the hterm thinks that when the meta key is pressed it's for hyperterm, and when not for the shell.

// passthrough all the commands that are meant to control
// hyperterm and not the terminal itself
const oldKeyDown = hterm.Keyboard.prototype.onKeyDown_;
hterm.Keyboard.prototype.onKeyDown_ = function (e) {
  if (e.metaKey) {
    return;
  }
  return oldKeyDown.call(this, e);
};

It should check if the shortcut is in use by hyperterm and if not send it to the shell.

Agreed, and then also the menu entries need to be updated to show the correct key combinations.

Related:
In macOS you can set keyboard shortcuts (in the system preferences) that will trigger a menu item by name. If you set next/previous tab to ctrl+tab/ctrl+shift+tab via this method, they still get captured by hyperterm, and it inserts escape characters.

I already fixed it, but my internet is to shitty to create a pull request... stay tuned.

On my Ubuntu 14.04:

Ctrl+Shift+N > Not working
Ctrl+Shift+T > Not working
Ctrl+Shift+W > Not working
Ctrl+Shift+Z > Not working
Ctrl+Shift+X > Doesn't cut, copy instead
Ctrl+Shift+Z > OK
Ctrl+Shift+V > OK
Ctrl+Shift+A > Not working
Ctrl+Shift+K > Kind working, it clears all the terminal (looks like a bug), but Ctrl+L is working just fine
Ctrl+R > Doesn't reload, it starts the reverse search instead (which is the right thing on Linux)
Ctrl+R > Same as Ctrl+R
Ctrl+Shift+I > Not working
Ctrl+0 > OK
Zoom in and Zoom out are working with Ctrl++ and Ctrl+-
Ctrl+Shift+U > Not working
Ctrl+Alt+Left > Not working
Ctrl+Alt+Right > Not working
F11 > Not working

Did anyone come with an idea on how to fix this ?

Apparently keyboard shortcuts are registered through the menu accelerators. Wouldn't it be better to register them through a specific service which would manage all shortcuts inside Hyperterm ?

Most "Cmd" shortcuts (corresponding to the windows key) are also not working on Gnome 3 (with Fedora 24). They are used to manage windows position, and the events never reach Hyperterm.
"Command" shortcuts are not natural on Linux anyway.

Im with @arthurflachs that it would be great to centralize all keyboard shortcuts in some sort of service. Maybe something like https://github.com/atom/atom-keymap that could map a keyboard shortcut to an action.

@nloomans what was your fix for this?

I don't think it was implemented yet @jdormit , but i'm curious to see what @nloomans did :)

Ah, I see. I am as will! I'm pretty new to the HyperTerm project, but if I find a work-around or a solution I'll post it here (and maybe do a pull request, if it is a good solution)

@rauchg Hi, any preference on which fix for this is the right one? Would you like to see https://github.com/atom/atom-keymap used?

@cjb that seems like a really good solution. Like @nloomans pointed out, our approach is really naive at the moment (equating meta key to app and otherwise to terminal).

We're using mousetrap to capture shortcuts in addition to the ones set up on menubar accelerators:
https://github.com/zeit/hyperterm/blob/7a01ec77c4edcec506b79a2f8ec10cee633849cd/lib/containers/hyperterm.js#L48

So... I don't know if this has changed or not, or if this is a solution, but @jaydson's list of shortcuts worked perfectly fine for me with the addition of the super key. e.g. super + ctrl + shift + i to open the dev console, super + ctrl + shift + u to update all of the plugins, etc. Even super + F11 to go fullscreen, oddly enough.

I'm using HyperTerm 0.7.1 on ArchLinux (installed via the AUR), but I'd assume this universal among distros.

@toroidal-code on Linux?

Yeah. Well, I just tried out the text selection short and _those_ aren't working. Which is just weird. But might be because my text-selection bindings are globally set to Emacs on my machine.

EDIT: And... it _is_ because of Emacs bindings. ctrl + w does cut, ctrl + y does paste/yank, etc. Go figure.

I'm using ubuntu 14.04 and I just have to add the super key to every shortcut listed in the menus.
For example, open a new tab is ctrl + t, on ubuntu super + ctrl + t. Seems to work for most of the shortcuts (haven't tried them all)

Would be nice if I didn't have to add that super though :+1:

@RasCarlito Using Ubuntu 16.04 can confirm that adding super to the above key combo's fixes them!

Can you expose the keybindings in .hyperterm.js so we can quickly override them there?

super is not on option for me, since I am using this as a meta key in i3. :/

Can you expose the keybindings in .hyperterm.js so we can quickly override them there?

I'd prefer that they work correctly out of the box.

Please add https://github.com/zeit/hyper/issues/274#issuecomment-241699565 as a workaround in some docs/faqs until this gets fixed.

super not working for me on Arch Linux with Gnome 3 and I'm having all the same issues described in https://github.com/zeit/hyper/issues/274#issuecomment-235455944

Yo everyone please test #1058! 馃檶

So what's the actual way to workaround? I'm having no luck trying to use screen because the ctrl + a on hyper binds to select all text visible and not to screen's default control characters. I'm working on a Fedora Workstation with hyper 1.1.0. I appreciate any comment.

Same, ctrl-a and ctrl-r are no longer available to bash, they get used for Hyper bindings instead. This presumably wasn't the intention? I suppose one way forward would be to disable bindings like ctrl-a that conflict with common uses?

The usual thing on Linux is for the terminal to take ctrl-shift-n, not ctrl-n.

@cjb, @n370 it looks like #1191 will hopefully fix this once and for all!

Hey guys, reverse search doesn't seems to work. Any workaround for that?

Tag for: #1509

Hi,

Any news ?
Thanks

CLOSED in #1876

Thanks !
Any idea for the date of a future release ?

It was the problem with the corrupted keyboard.
unknowingly i using the same keyboard i loaded ubuntu 16, ubuntu18 even ubuntu MATE, lubuntu, etc.
but post install either the OS was hanging, and in case the OS loaded properly Ctrl based operations were not working.
so i borrowed a PC from a friend, and the same problem occurred again in the new PC, i realized and changed my decade-old keyboard with a new usb based keyboard, and all the PC's are working fine now.
no more hanging and all Ctrl based operations are working good.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

orangecoloured picture orangecoloured  路  51Comments

mrjones2014 picture mrjones2014  路  64Comments

fabianschwarzfritz picture fabianschwarzfritz  路  48Comments

b0rski picture b0rski  路  66Comments

silvenon picture silvenon  路  94Comments