GithubHelp home page GithubHelp logo

olegberman / specialkey-emulator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sidneys/specialkey-emulator

0.0 3.0 0.0 10 KB

Emulate special keys (e.g. brightness, play/pause, increase volume) by emitting low-level global keyboard events - using NodeJS.

License: MIT License

Python 19.55% JavaScript 57.34% Objective-C++ 23.11%

specialkey-emulator's Introduction

specialkey-emulator


Emulate special keys (e.g. brightness, play/pause, increase volume) by emitting low-level global keyboard events - using NodeJS.

Contents

  1. Supported Platforms
  2. Requirements
  3. Roadmap
  4. Installation
  5. Usage
  6. API
  7. List of Special Key Names
  8. Author
  9. License

Supported Platforms

Currently OSX only (see Roadmap).
Tested on OSX 10.10 and 10.11.

Requirements

Node 4.0.0+

Roadmap

Installation

npm install specialkey-emulator --save

Usage

To trigger a key, simply require the module and directly call it with the name of the key to be triggered. See �List of Special Key Names for a list of currently supported keys.

Simple usage

specialkey = require('specialkey-emulator');

specialkey('NX_KEYTYPE_ILLUMINATION_DOWN')

Callback usage

specialkey = require('specialkey-emulator');

specialkey('NX_KEYTYPE_ILLUMINATION_DOWN', function (err, result) {
    if (err) {
        return console.log('Error', err);
    }
    console.log('Key triggered', result);
})

API

Overview

This module directly exports itself as a function:

require('specialkey-emulator')(keyName, callback)

Parameters

It takes the following parameters:

  • keyName (String) - Name of the key to be triggered. See List of Special Key Names�.
  • callback (Function) - Called after trying to trigger the special key.
    • error (Error) - Error
    • result (Number) - Internal code of the key which was called.

List of Special Key Names

OSX

  • Reference: Darwin Keyboard Events �@ opensource.apple.com
  • Names
    • NX_KEYTYPE_SOUND_UP
    • NX_KEYTYPE_SOUND_DOWN
    • NX_KEYTYPE_BRIGHTNESS_UP
    • NX_KEYTYPE_BRIGHTNESS_DOWN
    • NX_KEYTYPE_CAPS_LOCK
    • NX_KEYTYPE_HELP
    • NX_KEYTYPE_POWER_KEY
    • NX_KEYTYPE_MUTE
    • NX_KEYTYPE_UP_ARROW_KEY
    • NX_KEYTYPE_DOWN_ARROW_KEY
    • NX_KEYTYPE_NUM_LOCK
    • NX_KEYTYPE_CONTRAST_UP
    • NX_KEYTYPE_CONTRAST_DOWN
    • NX_KEYTYPE_LAUNCH_PANEL
    • NX_KEYTYPE_EJECT
    • NX_KEYTYPE_VIDMIRROR
    • NX_KEYTYPE_PLAY
    • NX_KEYTYPE_NEXT
    • NX_KEYTYPE_PREVIOUS
    • NX_KEYTYPE_FAST
    • NX_KEYTYPE_REWIND
    • NX_KEYTYPE_ILLUMINATION_UP
    • NX_KEYTYPE_ILLUMINATION_DOWN
    • NX_KEYTYPE_ILLUMINATION_TOGGLE

Author

Sidney Bofah

License

MIT

specialkey-emulator's People

Contributors

olegberman avatar sidneys avatar

Watchers

 avatar  avatar  avatar

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.