Giter Site home page Giter Site logo

combokeys's Introduction

Avocode app Join the Avocode Community on Slack

Design inspector for developers. Get CSS, SVG, image assets, fonts, colors. All without Photoshop or Sketch.

Purpose of this repository

The main purpose of this repository is for issue reporting. If you are Avocode user and you found a bug or you have an awesome idea for some feature enhancements, please create a new issue in its recommended format.

Changelog

The latest release notes can be found on changelog.avocode.com.

Reporting an issue

If you found a bug, please report an issue in the following format:

  • Reproducibility:
  • Description:
  • Steps to reproduce:
  • Expected result:
  • Actual result:
  • OS and app versions:

Also please include screenshots, if possible

Submitting an idea or enhancement

Please submit and vote for your ideas on https://avocode.uservoice.com

combokeys's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

combokeys's Issues

add in a CmdOrCtrl/CommandOrControl Key

Electron Accelerators have a special key called "CtrlOrCmd" that will intelligently choose whether to use one or the other, depending on platform: https://github.com/electron/electron/blob/master/docs/api/accelerator.md#platform-notice

It think this would be great for combokeys too. Here is some code to achieve this using combokeys in Electron (for a more generic option, swap out out the ternary statement for something checking navigator.platform)

const CmdOrCtrl = process.platform === 'darwin' ? 'command' : 'ctrl';
combokeys.bind([`${CmdOrCtrl}+S`], function(e) {
    _saveDraft();
    return false;
});

But I would prefer to just write:

combokeys.bind([`CmdOrCtrl+S`], function(e) {
    _saveDraft();
    return false;
});

I think it would make a pleasant improvement to this nice library :)

Bindings for `mod-(`, `alt-*`, etc.

Combokeys supports bindings directly to characters like "(" or "*", which appear under different physical keys depending on the international format of the keyboard.

Is there a way to add a modifier to such bindings, such as mod+(?

Creating a binding for mod+( or alt+( doesn't seem to work. If one tries to get around this by binding to the underlying key, eg. mod+shift+9, then you get the original trouble of ( not being under 9 on non-US keyboards.

I've created a little app where this behaviour can be observed and tested:
http://keys-test.lark.cloud/?library=Combokeys&keystring=M1%2520%2528

dom-event@^0.0.5 is unpublished and combokeys cannot be installed from NPM any more

> npm i combokeys
npm ERR! Darwin 15.3.0
npm ERR! argv "/Users/******/.nvm/versions/node/v5.7.1/bin/node" "/Users/******/.nvm/versions/node/v5.7.1/bin/npm" "i" "combokeys"
npm ERR! node v5.7.1
npm ERR! npm  v3.6.0

npm ERR! No compatible version found: dom-event@^0.0.5
npm ERR! Valid install targets:
npm ERR! 2.0.0
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/skladchikov/Documents/github/npm-debug.log

That's why it was unpublished https://medium.com/@azerbike/i-ve-just-liberated-my-modules-9045c06be67c#.f4lrbinzn

Repo maintenance

Hi there, I've recently forked mousetrap to close bugs and merge pull requests, not having realised you've already done so.

Is anyone still actively maintaining this repo? I don't want to waste time and effort fixing already fixed bugs.

Does GlobalBind work outside of the browser in Electron setups?

Going out on a limb here but unsure whether this library and/or the Global Bind plugin would be able to catch keyboard shortcuts outside of an Electron application?

I ask because while Electron has the globalShortcuts module, it doesn't allow to check when a shortcut has been released.

Is that possible with combokeys at all?

Binding multiple combinations does not work as expected (or the callback needs an extra parameter)

Let's say I have the letters "a", "b", and "c" and want to bind a different callback for each unique combination on keyup (think a "chord" in music where you press multiple keys at the same time).

For simplicity let's have only 3 combinations:

  • ["a", "b"] (the one I will press)
  • ["a", "c"]
  • ["c", "b"]

If I bind the above 3 sequences, when I press and hold "a" and "b", the callback will be called twice, for:

  • ["a", "c"] - it seems to pick a combination where the 1st letter matches the 1st letter in the bound sequence
  • ["c", "b"] - ditto - picks a combination where the 2nd letter matches the 2nd letter in the bound sequence

What I need is for it to trigger only for ["a", "b"] which are the 2 keys I actually pressed.

In the title of the issue, when I said "or the callback needs an extra parameter" I meant that instead of just passing the keyboard event as an argument, the library could pass the actual sequence (e.g. ["a", "c"]), and then I'd be able to filter out the "bogus" combinations. This will not fix my issue (now), because as I explained, the callback for the ["a", "b"] combination that I'm expecting to be called is not called at all.

I'm not in a hurry (can wait a couple of months), but if you're too busy or don't recognize this as something that's needed, please comment on the issue, and I'll either fork it, or create a PR (if you think that's useful).

Thanks!

Internationalized Keyboard Issues

So I have come across two issues that appear with regards to international keyboard layouts.

The bug appears to manifest itself in the characterFromEvent method.

Issue 1:

The first issue is kind a logical one, so I would not be surprised if you marked it as a wontfix.

If we take the following bind: ctrl+/, it appear innocuous enough, however many international keyboard layouts put / on a number key, accessible via shift (for example, on a Portuguese keyboard layout, / is accessibly using shift on the the 7 key).

This keybind will no longer work on international keyboards since they require shift to be held in order to access the / key. This could be a slippery support to allow keybinds to smartly take into account the various layouts.

Issue 2:

I can sort of work around the previous issue by adding shift as a secondary bind: ['ctrl+/', 'ctrl+shift+/']. However this only works on Mac, PC will still not trigger the callback.

I did some console sniffing and found that while the KeyboardEvent accurately reports the / in event.key on both Windows and Mac, however the logic to determine the key actually reports 7. You guys heavily depend on e.which, which on Mac (no pun intended) reports 191 and on Windows reports 55.

I guess the first question would be, how come you guys don't use event.key? I assume there must've been some older browser bug, or something that makes that API unreliable? Or perhaps some other reason? Anyways, in this case, I really need to be agnostic regarding international layouts since I develop an application that is heavily used internationally, Discord.

Can't prevent some browsers events

Hi,
I've been trying to add this to a website for quite some times. Everything works fine on Chrome and Opera, but when comes the time for Firefox and Edge the browser actions happen before the ComboKey's one.
For example:

$(document).ready(function () {
    var cb = new Combokeys(document);
    cb.bind('option+t', function(e) { debugger; console.log('Hello World'); return false; });
}

When doing the action on Firefox the 'Tools Menu' appear and then I get to do on debugger, etc.
In Edge, firing alt+d select the browser navigation bar.
Some help would be nice!
Thanks, Alexandre.

bower support

Should be great to have a bower.json in order to support the bower package management.

Browserify does not work with plugin Global Bind

I am working on a project that needs this feature by default on front end. However when i invoke the bindglobal function, it is throwing error for trying to override the stopCallback function. I have did another version to include this by default.

Going further , you can check whether ctrl / alt / cmd is part of the combo then try to bind it global by default?

Cancel sequence hotkey when interrupted by other characters?

The following sequence works as expected:

combokeys.bind('q n', function(){ ... })'

However if I bind a combination as well as the sequence:

combokeys.bind(['q+n', 'q n'], function(){ ... })'

or bind the sequence first and then the combination:

combokeys.bind('q+n', function(){ ... })'
combokeys.bind('q n', function(){ ... })'

then both the combination and sequence correctly call the handler, but pressing a key inbetween the q and n, also causes the handler to be called.

q+n -> handler called
q n -> handler called
q f n -> handler also called

Is this a limitation of the library, or is there a way to disallow extraneous keys inbetween sequence keys?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.