-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathindex.d.ts
172 lines (143 loc) · 2.98 KB
/
index.d.ts
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
type XbarOptions = {
/**
The text to show. The only required property.
*/
readonly text: string;
/**
The URL that will be opened when the menu item is clicked.
*/
readonly href?: string;
/**
Change the text color.
*/
readonly color?: string;
/**
Change the text font.
*/
readonly font?: string;
/**
Change the text size.
*/
readonly size?: number;
/**
Run a script.
*/
readonly bash?: string;
/**
Parameters to specify as arguments for the script, specified in `bash`.
*/
readonly param1?: string;
/**
Parameters to specify as arguments for the script, specified in `bash`.
*/
readonly param2?: string;
/**
Parameters to specify as arguments for the script, specified in `bash`.
*/
readonly param3?: string;
/**
Parameters to specify as arguments for the script, specified in `bash`.
*/
readonly param4?: string;
/**
Parameters to specify as arguments for the script, specified in `bash`.
*/
readonly param5?: string;
/**
Start the script with Terminal.
*/
readonly terminal?: boolean;
/**
Refresh the plugin.
*/
readonly refresh?: boolean;
/**
Show the item in the dropdown.
*/
readonly dropdown?: boolean;
/**
Truncate the line to the specified number of characters.
*/
readonly length?: number;
/**
Trim the leading and trailing whitespace from the text.
*/
readonly trim?: boolean;
/**
Mark the line as an alternate to the previous line, for when the Option key is pressed, in the dropdown.
*/
readonly alternate?: boolean;
/**
Set an image for the item. It must be a Base64 encoded string.
*/
readonly templateImage?: string;
/**
Set an image for this item. It must be a base64 encoded string.
*/
readonly image?: string;
/**
Convert text to emojis, such as `:mushroom:`.
*/
readonly emojize?: boolean;
/**
Enable parsing of ANSI codes.
*/
readonly ansi?: boolean;
};
export type Options = {
/**
Add a submenu to the item. A submenu is composed of an array of items.
*/
readonly submenu?: Array<string | Options | typeof separator>;
} & XbarOptions;
export type TopLevelOptions = Omit<Options, 'text'>;
/**
Add a separator.
*/
export const separator: unique symbol;
/**
Check whether dark mode is enabled.
*/
export const isDarkMode: boolean;
/**
Check whether the script is running from xbar.
*/
export const isXbar: boolean;
/**
Create a plugin for xbar.
@param items - xbar items.
@param options - Options for all xbar items.
@example
```
#!/usr/bin/env node --input-type=module
import xbar, {separator, isDarkMode} from 'xbar';
xbar([
{
text: '❤',
color: isDarkMode ? 'white' : 'red',
dropdown: false
},
separator,
{
text: 'Unicorns',
color: '#ff79d7',
submenu: [
{
text: ':tv: Video',
href: 'https://www.youtube.com/watch?v=9auOCbH5Ns4'
},
{
text: ':book: Wiki',
href: 'https://en.wikipedia.org/wiki/Unicorn'
}
]
},
separator,
'Ponies'
]);
```
*/
export default function xbar(
items: ReadonlyArray<string | Options | typeof separator>,
options?: TopLevelOptions
): void;