Community-edition: Support common back/forward keyboard shortcuts

Created on 15 Feb 2017  ·  9Comments  ·  Source: ramboxapp/community-edition

Similar to #243, there are some common keyboard shortcuts for navigating back/forward in a browser that (I think) should be supported inside Rambox, e.g., ⌘+[ and ⌘+] on Mac (I think it's CTRL+← and CTRL+→ on Linux/Windows).

enhancement

Most helpful comment

Thanks very much @hoelzro ! Works perfectly, and a been driving me crazy not having a way back to my last convo in slack in Franz and Rambox.. Here's the code for Linux (and I think it's the same on Windows).

document.addEventListener('keydown', function(e) {
  if(e.getModifierState('Alt')) {
    if (e.keyCode == '37') { // left arrow
      history.back();
    } else if (e.keyCode == '39') { // right arrow
      history.forward();
    }
  }
});

All 9 comments

Is this functionality added to the app?

Ok, I just checked in Windows and is Alt instead of Ctrl key.

@shr1k4nt It will be in v1.0.0.

Just to note that on MacOS X, these are usually ⇧⌘[ to switch to tab on left and ⇧⌘[ to switch to tab to right.

For Slack, I just added this custom code to make Ctrl + [ and Ctrl + ] go back/forwards:

document.addEventListener('keydown', function(e) {
  if(e.getModifierState('Control')) {
    if(e.key == '[') {
      history.back();
    } else if(e.key == ']') {
      history.forward();
    }
  }
});

There's probably a more elegant way to get this working more generally within Rambox itself, but I'm not familiar enough with the codebase to be able to say what that is.

Thanks very much @hoelzro ! Works perfectly, and a been driving me crazy not having a way back to my last convo in slack in Franz and Rambox.. Here's the code for Linux (and I think it's the same on Windows).

document.addEventListener('keydown', function(e) {
  if(e.getModifierState('Alt')) {
    if (e.keyCode == '37') { // left arrow
      history.back();
    } else if (e.keyCode == '39') { // right arrow
      history.forward();
    }
  }
});

@shanness Nice! The JS-code looks easy as pie but my problem is I currently don't have a clue where to put it ... did you edit the app.js directly or where did you place it?

@el-seirh If you go to the services tab in Rambox, click on the gear next to a Slack service, and click on the "Advanced" section, there's a "Custom code" input where you can paste that code.

@hoelzro Cool, did not know that custom code feature. Works like a charm, thanks!

AWESOME... thx so much @hoelzro + @shanness for sharing, using Slack all day long this was #1 downer.
Your custom code works perfectly!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mforcer picture mforcer  ·  3Comments

biggestchops picture biggestchops  ·  3Comments

igalic picture igalic  ·  3Comments

andrii-riabchun picture andrii-riabchun  ·  3Comments

SimJoSt picture SimJoSt  ·  4Comments