Coder Social home page Coder Social logo

qhotkeys's Introduction

qHotkeys

Global shotcut replacement for Electron's implementation without preventing native OS shortcuts.

This project utilizes uiohook-napi. It depends on them and might not work on every system nor node/electron version.

My purpose in creating qHotkeys was to be a replacement for Electron's global shortcut. With qHotkeys you can create a shortcut such as CommandOrControl + X and your app will still recognize the input AND your os will perform the 'cut' action

This project is early in development. Report any bugs or issues on the GitHub issue tracker.

Installation

Install qHotkeys using npm:

npm i qhotkeys

Example Implementation

import { qKeys, qHotkeys } from 'qHotkeys'

// Create instance
var hotkeys = new qHotkeys()

// ... 
app.whenReady().then(() => {

    // ...

    // Your custom actions
    const hotkeyAction = () => {
        console.log("I pressed my hotkeys!")
    }

    const scrollUpAction = () => {
        console.log("I scrolled up!")
    }

    const scrollDownAction = () => {
        console.log("I scrolled down!")
    }

    // Registers your hotkey actions
    // Command or Control + X = hotkeyAction called
    hotkeys.register([qKeys.CmdOrCtrl, qKeys.X], hotkeyAction)
    
    // Registers your scroll actions
    // Command or Control + ScrollUp = scrollUpAction called
    // Command or Control + ScrollDown = scrollDownAction called
    hotkeys.registerScroll([qKeys.CmdOrCtrl], scrollUpAction, scrollDownAction)
    
    // For scroll register, the hotkey list can be empty
    hotkeys.registerScroll([], scrollUpAction, scrollDownAction)

    // Starts
    hotkeys.run()
    
    // ...
})

To-Do List

This project is early in development and I have lots of ideas to expand the capabilities. Here's a roadmap of planned additions to qHotkeys.

  • Add event info to the action callbacks
  • Individual scroll registers
  • Add mouse buttons
  • Add mouse move
  • Horizontal Scroll

Anymore ideas? Create an issue on the github page!

License

MIT

Maintained by QarthO.

qhotkeys's People

Contributors

chuski1212 avatar meadowsjared avatar qartho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

qhotkeys's Issues

Feature ideas

  • multitouch/gestures support
  • gamepad support
  • midi device support?

Build 1.1.1 is not updated on npmjs.com

I'm sorry sir but the version 1.1.1 build on npmjs has the new package.json file, but it somehow is missing all the new functions like unregisterAll etc...

Steps to reproduce:
npm i [email protected]

Trying to use it:
image

You should notice the files in the node_modules/dist folder appear to be outdated possibly from version 1.0.15, and is missing unregister() and unregisterAll() functions
index.d.ts
image
index.js
image

Maybe with this latest build you forgot to run npm run build before publishing ๐Ÿค”?

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.