-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·30 lines (28 loc) · 1.31 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const {execFileSync} = require('child_process');
const create = script => () => execFileSync('osascript', ['-e', script]);
const createKey = key => create(`tell application "System Events" to key code ${key}`);
const createKeyCmd = key => createKey(`${key} using command down`);
exports.lightsUp = createKey('113');
exports.lightsDown = createKey('107');
exports.highlightPrevious = createKeyCmd('126');
exports.densityDown = createKey('96');
exports.densityUp = createKey('97');
exports.launchPad = createKey('131');
exports.splitScreen = createKey('160');
exports.spreadScreen = createKey('103');
exports.closeWindow = createKeyCmd('13');
exports.closeEverything = createKeyCmd('12');
exports.newTab = createKeyCmd('17');
exports.newWindow = createKeyCmd('45');
exports.splitTabs = createKeyCmd('2');
exports.search = createKeyCmd('3');
exports.clear = createKeyCmd('40');
exports.paste = createKeyCmd('9');
exports.hide = createKeyCmd('46');
exports.zoom = createKeyCmd('27');
exports.config = createKeyCmd('43');
exports.minimize = createKeyCmd('29');
exports.shutDown = createKey('12 using {command down, shift down}');
exports.screenshot = createKey('20 using {command down, shift down}');
exports.mute = create('set volume 0');
exports.volumeUp = create('set volume output volume (output volume of (get volume settings) + 1) --100%');