A library for customizing the Nuimo device on OSX.
You can implement your own event handler for each particular application by extending NuimoHandler
trait.
The library provides some useful functions for handling Nuimo.
- Reading battery information
- Typing keystrokes
- Executing applescripts
- Handling events of a (multiple-) click, swipes, rotations, and fly actions (incl. height info.)
- Displaying an LED image
The library also bundles some example handlers:
- Volume controller (DefaultHandler)
- iTunes controller (DefaultHandler)
- Google chrome YouTube controller (GoogleChromeHandler)
- Adobe Lightroom controller (LightroomHandler)
- Microsoft Power Point controller (PowerPointHandler)
- Install
- a recent version of Java JDK
- sbt
- node.js (v6.2.2+)
- Xcode
- Then, run
npm install @abandonware/noble
to install noble: A Node.js BLE (Bluetooth Low Energy) library. npm rebuild
- Clone this library.
On your console,
cd /path/to/nuimode
cp config/nuimo_config_example.txt config/nuimo_config.json
- Run
sbt run
- Turn on your Nuimo.
- Confirm the UUID of your Nuimo on the console.
- Paste the UUID on
config/nuimo_config.json
- Type
Ctrl-C
to stop Nuimode - Run
sbt run
again.
If you want to implement your own handler, see yuima.nuimo.handler.NuimoHandler
and yuima.nuimo.handler.DeafaultHander
for example.
In order to use your handler, you have to define a mapping between an application's name and the handler by modifying config/nuimo_config.json
and yuima.nuimo.config.Config
object.
For example, if you create a new object SafariHandler
, you have to edit yuima.nuimo.config.Config.HandlerID
as:
object HandlerID extends Enumeration {
val Default, PowerPoint, Lightroom, GoogleChrome, Safari = Value
}
Then you modify yuima.nuimo.config.Config.id2handler
as:
val id2handler = Map(
HandlerID.Default -> yuima.nuimo.defaultHandler,
HandlerID.PowerPoint -> PowerPointHandler,
HandlerID.Lightroom -> LightroomHandler,
HandlerID.GoogleChrome -> GoogleChromeHandler,
HandlerID.Safari -> SafariHandler
)
Finally, you assign the application name to the handler on config/nuimo_config.json
as:
[
{
"uuid": "123qweasdzxc456rtyfghvbn789uiojk",
"name": "Left-hand Nuimo on MBA",
"handlers": {
"Microsoft PowerPoint.app": "PowerPoint",
"Adobe Lightroom.app": "Lightroom",
"Google Chrome.app": "GoogleChrome",
"Safari.app": "Safari"
}
}
]
Some JS scripts used in the library are forked from the following projects.