-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom.js
123 lines (100 loc) · 3.22 KB
/
custom.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* Serenade Custom Commands
In this file, you can define your own custom commands with the Serenade API.
For instance, here's a custom automation that opens your terminal and runs a command:
serenade.global().command("make", api => {
api.focusApplication("terminal");
api.typeText("make clean && make");
api.pressKey("return");
});
And, here's a Python snippet for creating a test method:
serenade.language("python").snippet(
"test method <%identifier%>",
"def test_<%identifier%>(self):<%newline%><%indent%>pass",
{ "identifier": ["underscores"] }
"method"
);
For more information, check out the Serenade API documentation: https://serenade.ai/docs/api
*/
serenade.global().command("restart rails", (api) => {
api.focusOrLaunchApplication("i term");
api.pressKey("1", ["command"]);
api.pressKey("c", ["control"]);
api.pressKey("up");
api.pressKey("enter");
});
serenade.global().command("check status", (api) => {
api.focusOrLaunchApplication("i term");
api.typeText("git status");
api.pressKey("enter");
});
serenade.global().command("check diff", (api) => {
api.focusOrLaunchApplication("i term");
api.typeText("git diff");
api.pressKey("enter");
});
serenade.global().command("pry", (api) => {
api.typeText("binding.pry");
});
serenade.global().command("chrome", (api) => {
api.focusOrLaunchApplication("chrome");
});
serenade.global().command("visual", (api) => {
api.focusOrLaunchApplication("visual");
});
serenade.global().command("terminal", (api) => {
api.focusOrLaunchApplication("i term");
});
serenade.global().command("slack", (api) => {
api.focusOrLaunchApplication("slack");
});
serenade.global().command("discord", (api) => {
api.focusOrLaunchApplication("discord");
});
serenade.global().command("minimize", (api) => {
api.pressKey("m", ["command"]);
});
serenade.global().command("restart rails", (api) => {
api.pressKey("1", ["command"]);
});
serenade.app("chrome").command("find <%text%>", async (api, matches) => {
await api.pressKey("f", ["command"]);
await api.typeText(matches.text);
});
serenade.global().command("screenshot", (api) => {
api.pressKey("4", ["command", "shift"]);
});
serenade.global().command("parse <%text%>", async (api, matches) => {
await api.pressKey("f", ["command"]);
await api.typeText(matches.text);
});
serenade.global().command("double click", async (api) => {
await api.command("click");
await api.command("click");
});
serenade.global().command("messages", (api) => {
api.focusOrLaunchApplication("messages");
});
serenade.global().command("lock computer", (api) => {
api.pressKey("q", ["command", "control"]);
});
serenade.global().command("slap", async (api) => {
await api.pressKey("escape");
await api.pressKey("enter");
});
serenade.global().command("next", (api) => {
api.pressKey("enter");
});
serenade.global().command("previous", (api) => {
api.pressKey("enter", ["shift"]);
});
serenade.global().command("recurse <%text%>", async (api, matches) => {
await api.pressKey("r", ["control"]);
await api.typeText(matches.text);
});
// to do
serenade.app("iTerm").command("clear", (api) => {
api.pressKey("c", ["control"]);
});
serenade.app("chrome").command("inspect", (api) => {
api.pressKey("c", ["command", "shift"]);
});