1 |
|
2 |
|
3 | function toggle (onoff) {
|
4 | const cp = require('child_process')
|
5 | if (exports.platform !== 'darwin') return
|
6 | try {
|
7 | cp.execSync(`osascript -e 'if application "yubiswitch" is running then tell application "yubiswitch" to ${onoff}'`, {stdio: 'inherit'})
|
8 | } catch (err) {}
|
9 | }
|
10 |
|
11 | exports.enable = () => toggle('KeyOn')
|
12 | exports.disable = () => toggle('KeyOff')
|
13 |
|
14 | exports.platform = process.platform
|