-
Notifications
You must be signed in to change notification settings - Fork 4
/
syncthing-custom.el
315 lines (267 loc) · 9.6 KB
/
syncthing-custom.el
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
;;; syncthing-custom.el --- Client for Syncthing -*- lexical-binding: t; -*-
;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Commentary:
;;; Code:
(require 'syncthing-groups)
(defcustom syncthing-format-buffer
"*syncthing(%s)*"
"Client's buffer name with a `%s' placeholder for address."
:group 'syncthing-startup
:group 'syncthing-format
:type 'string)
(defcustom syncthing-trace-format-buffer
"*syncthing trace(%s)*"
"Tracing buffer name with a `%s' placeholder for address."
:group 'syncthing-debug
:group 'syncthing-format
:type 'string)
(defcustom syncthing-default-name
"Default Localhost"
"Default client name for `syncthing-format-buffer'."
:group 'syncthing
:type 'string)
(defcustom syncthing-base-url
"https://127.0.0.1:8384"
"Base URL for Syncthing REST API endpoint."
:group 'syncthing
:type 'string)
(defcustom syncthing-format-perc
"%6.2f%%"
"Format for displaying process percentage."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-format-rate-download
" %s"
"Format for displaying download rate in header line."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-format-rate-upload
" %s"
"Format for displaying upload rate in header line."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-format-count-local-files
" %s"
"Format for displaying local files count in header line."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-format-count-local-folders
" %s"
"Format for displaying local folders count in header line."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-format-count-local-bytes
" ~%s"
"Format for displaying local size in header line."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-format-count-listeners
" %s"
"Format for displaying listeners count in header line."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-format-count-discovery
" %s"
"Format for displaying discovery count in header line."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-format-uptime
" %s"
"Format for displaying Syncthing server uptime in header line."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-format-my-id
" %s"
"Format for displaying current device's ID in header line."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-format-version
" %s"
"Format for displaying version in header line."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-cleanup-priority
0
"`add-hook' priority."
:group 'syncthing-cleanup
:type 'number)
(defcustom syncthing-default-server-token
""
"Syncthing REST API token."
:group 'syncthing
:type 'string)
(defcustom syncthing-start-collapsed
t
"Start all items collapsed."
:group 'syncthing-startup
:group 'syncthing-display
:type 'boolean)
(defcustom syncthing-start-with-auto-refresh
t
"Start with auto-refresh enabled."
:group 'syncthing-startup
:type 'boolean)
(defcustom syncthing-auto-refresh-interval
10
"Number of seconds to wait before refreshing client buffer."
:group 'syncthing-time
:type 'number)
(defconst syncthing-header-rate-download "rate-download"
"Header value for `syncthing-header-items'.")
(defconst syncthing-header-rate-upload "rate-upload"
"Header value for `syncthing-header-items'.")
(defconst syncthing-header-count-local-files "count-local-files"
"Header value for `syncthing-header-items'.")
(defconst syncthing-header-count-local-folders "count-local-folders"
"Header value for `syncthing-header-items'.")
(defconst syncthing-header-count-local-bytes "count-local-bytes"
"Header value for `syncthing-header-items'.")
(defconst syncthing-header-count-listeners "count-listeners"
"Header value for `syncthing-header-items'.")
(defconst syncthing-header-count-discovery "count-discovery"
"Header value for `syncthing-header-items'.")
(defconst syncthing-header-uptime "uptime"
"Header value for `syncthing-header-items'.")
(defconst syncthing-header-my-id "my-id"
"Header value for `syncthing-header-items'.")
(defconst syncthing-header-version "version"
"Header value for `syncthing-header-items'.")
(defcustom syncthing-header-items
'("rate-download" "rate-upload" "count-local-files" "count-local-folders"
"count-local-bytes" "count-listeners" "count-discovery" "uptime" "my-id"
"version")
"Items to render with `header-line-format'.
Special meaning for empty list / nil to skip rendering the header line."
:group 'syncthing-display
:type `(repeat
(choice :tag "Item"
(const :tag "Download rate" ,syncthing-header-rate-download)
(const :tag "Upload rate" ,syncthing-header-rate-upload)
(const :tag "Files" ,syncthing-header-count-local-files)
(const :tag "Folders" ,syncthing-header-count-local-folders)
(const :tag "Size" ,syncthing-header-count-local-bytes)
(const :tag "Listeners" ,syncthing-header-count-listeners)
(const :tag "Discovery" ,syncthing-header-count-discovery)
(const :tag "Uptime" ,syncthing-header-uptime)
(const :tag "ID" ,syncthing-header-my-id)
(const :tag "Version" ,syncthing-header-version))))
(defcustom syncthing-display-logs
nil
"Display logs in `syncthing-buffer'."
:group 'syncthing-display
:type 'boolean)
(defcustom syncthing-timeout-events
0
"Amount of time to wait for server to generate events."
:group 'syncthing-times
:type 'number)
(defcustom syncthing-display-changes
t
"Display recent-changes in `syncthing-buffer'.
Note:
Syncthing timeouts after 60s with [] when there are no events and the
listener waits for some to be emitted which causes Emacs to hang while
waiting for the response but can be stopped with \\[keyboard-quit].
This is customized with `syncthing-timeout-events'.
https://docs.syncthing.net/rest/events-get.html"
:group 'syncthing-display
:type 'boolean)
(defcustom syncthing-limit-changes
25
"Limit of items for recent changes."
:group 'syncthing-limits
:type 'number)
(defcustom syncthing-debug
nil
"Enable debugging logs in special buffer."
:group 'syncthing-debug
:type 'boolean)
(defcustom syncthing-prefix
"syncthing"
"Prefix for `message' logs."
:group 'syncthing-debug
:type 'string)
(defcustom syncthing-decimal-separator
"."
"Stylize number with custom decimal separator."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-thousands-separator
" "
"Stylize number with custom thousands separator."
:group 'syncthing-format
:type 'string)
(defcustom syncthing-watch-events
t
"Poll Syncthing server for events such as status, files or errors.
Note:
Syncthing timeouts after 60s with [] when there are no events and the
listener waits for some to be emitted which causes Emacs to hang while
waiting for the response but can be stopped with \\[keyboard-quit].
This is customized with `syncthing-timeout-events'.
https://docs.syncthing.net/rest/events-get.html"
:group 'syncthing-events
:type 'boolean)
(defcustom syncthing-watch-events-interval
1
"Number of seconds to wait before polling for next event batch."
:group 'syncthing-events
:group 'syncthing-time
:type 'number)
(defcustom syncthing-no-upstream-noise
t
"Prevent any upstream library to pollute minibuffer with `message'.
Many libs, modes and other facilities have their info messages, but can be
annoying or hide more urgent messages when used at large scale or in short
intervals. Setting this to non-nil allows `syncthing' to purge all of them."
:group 'syncthing-debug
:type 'boolean)
(defcustom syncthing-info
t
"Show info messages in minibuffer."
:group 'syncthing-debug
:type 'boolean)
(defconst syncthing-header-uptime-short "uptime-short"
"Header value for `syncthing-header-uptime-type'.")
(defconst syncthing-header-uptime-full "uptime-full"
"Header value for `syncthing-header-uptime-type'.")
(defconst syncthing-header-uptime-padded-short "uptime-padded-short"
"Header value for `syncthing-header-uptime-type'.")
(defconst syncthing-header-uptime-padded-full "uptime-padded-full"
"Header value for `syncthing-header-uptime-type'.")
(defcustom syncthing-header-uptime-type
syncthing-header-uptime-padded-short
"Items to render with `header-line-format'.
Special meaning for empty list / nil to skip rendering the header line."
:group 'syncthing-display
:type `(choice :tag "Type"
(const :tag "[0d] [0h] [0m] [0s]"
,syncthing-header-uptime-short)
(const :tag "0d 0h 0m 0s"
,syncthing-header-uptime-full)
(const :tag "[000d] [00h] [00m] [00s]"
,syncthing-header-uptime-padded-short)
(const :tag "000d 00h 00m 00s"
,syncthing-header-uptime-padded-full)))
(defcustom syncthing-align-folder-headers
3
"`:align-to' value for aligning text block for values in folder widget."
:group 'syncthing-display
:type 'number)
(defcustom syncthing-align-folder-values
20
"`:align-to' value for aligning text block for values in folder widget."
:group 'syncthing-display
:type 'number)
(defcustom syncthing-align-device-headers
3
"`:align-to' value for aligning text block for values in device widget."
:group 'syncthing-display
:type 'number)
(defcustom syncthing-align-device-values
20
"`:align-to' value for aligning text block for values in device widget."
:group 'syncthing-display
:type 'number)
(provide 'syncthing-custom)
;;; syncthing-custom.el ends here