-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpolify.1
345 lines (277 loc) · 7.53 KB
/
polify.1
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
.nh
.TH POLIFY 1 2020\-06\-03 Linux "User Manuals"
.SH NAME
.PP
\fB\fCpolify\fR \- Update polybar hookmodules in a safe
and smooth way
.SH SYNOPSIS
.PP
.RS
.nf
polify \-\-module|\-o TARGET\-MODULE [OPTIONS] [MESSAGE]
polify \-\-module|\-o TARGET\-MODULE [\-\-pid|\-p PID] [\-\-foreground|\-f COLOR] [\-\-background|\-b COLOR] [\-\-leftclick|\-l COMMAND] [\-\-rightclick|\-r COMMAND] [\-\-middleclick|\-m COMMAND] [\-\-scrollup|\-u COMMAND] [\-\-scrolldown|\-d COMMAND] [\-\-prefix|\-e STRING [ [\-\-foreground\-prefix|\-F COLOR] [\-\-background\-prefix|\-B COLOR] [\-\-leftclick\-prefix|\-L COMMAND] [\-\-rightclick\-prefix|\-R COMMAND] [\-\-middleclick\-prefix|\-M COMMAND] [\-\-scrollup\-prefix|\-U COMMAND] [\-\-scrolldown\-prefix|\-D COMMAND] ] [\-\-expire\-time|\-t SECONDS] [\-\-msg|\-s MESSAGE] [MESSAGE]
polify \-\-module|\-o TARGET\-MODULE [\-\-pid|\-p PID] \-\-clear|\-x
polify \-\-help|\-h
polify \-\-version|\-v
.fi
.RE
.SH DESCRIPTION
.PP
For \fBpolify\fP to work, there needs to be at
least one module of the type \fB\fCcustom/ipc\fR and the
setting \fB\fCenable\-ipc\fR needs to be set to true in
the polybar configuration file.
.PP
\fB\fC\~/.config/polybar/config\fR
.PP
.RS
.nf
[bar/example]
enable\-ipc = true
...
[module/polifyModule1]
type = custom/ipc
hook\-0 = polify \-\-module polifyModule1
...
.fi
.RE
.PP
When polify is executed with only the \fB\fC\-\-module
MODULE\_NAME\fR option, all it will do is \fB\fCcat\fR the
content of the file: \fB\fC/tmp/polify/MODULE\_NAME\fR
(\fIor \fB\fCecho\fR a blank line if the file doesn't
exist\fP). When this is done from a \fBpolybar\fP
module it will set the modules text to \fBthe last
line\fP of the file.
.PP
Any arguments to the \fB\fCpolify\fR command that
doesn't belong to an option, will get redirected
(and formatted if needed or requested) to
\fB\fC/tmp/polify/MODULE\_NAME\fR\&. Then the command
\fB\fCpolybar\-msg hook MODULE\_NAME 1\fR will get executed
by \fBpolify\fP, causing the module to get updated.
.PP
EXAMPLE:
.PP
.RS
.nf
$ polify \-\-module polifyModule1 testing one three four
.fi
.RE
.PP
this will first create (or overwrite) the file:
/tmp/polify/polifyModule1 with the single line:
testing one three four
.PP
then the command: \fB\fCpolybar\-msg hook polifyModule1
1\fR is automatically executed, triggering the first
hook to execute: (polify \-\-module polifyModule1),
which in turn will update the module with the
string: "testing one three four"
.PP
The \fB\fC\-\-expire\-time SECONDS\fR option can be used to
clear the module when SECONDS have passed. It is
also possible to manually clear a module with the
\fB\fC\-\-clear\fR option.
.PP
The text can be forced to have a specific
background, foreground or mouse\-button actions. It
is also possible to prefix the string with another
string, the prefix in turn can have different
colors and actions:
.PP
EXAMPLE:
.PP
.RS
.nf
$ polify \-\-module polifyModule1 \\
\-\-foreground '#FF00FF' \\
\-\-background '#000000' \\
\-\-rightclick 'notify\-send "polify rc"' \\
\-\-prefix "test module: " \\
\-\-foreground\-prefix '#FFF000' \\
\-\-background\-prefix '#0000FF' \\
\-\-leftclick\-prefix 'notify\-send "clicking prefix"' \\
this is the main string
$ cat /tmp/polify/polifyModule1
%{F#FFF000}%{B#0000FF}%{A1:notify\-send "clicking prefix":}test module: %{A}%{F\-}%{B\-}%{F#FF00FF}%{B#000000}%{A3:notify\-send "polify rc":}this is the main string%{F\-}%{B\-}%{A}
.fi
.RE
.PP
Since only the last line of the file is the one
that will be visible in the bar, it is possible to
write and read text to the file and use them to
f.i. store the state of a module. This is
conveniently done by using the \fB\fC\-\-msg MESSAGE\fR
option.
.PP
polify is shipped with the script \fBpolifypop\fP,
which can be used to execute commands on the
\fB\fC\-\-msg\fRline. It will only execute a command if it
is prefixed with the word \fBPOLIPOP\fP\&. And the
first argument to \fBpolifypop\fP needs to be the
name of the module, it is cool to bind polifypop
to a hotkey...
.PP
.RS
.nf
$ polify \-\-module polifyModule1 \-\-msg "mode1" \-\-foreground '#FF0000' this is mode one
$ cat /tmp/polify/polifyModule1 | head \-1
mode1
.fi
.RE
.PP
.RS
.nf
$ polify \-\-module polifyModule1 \-\-msg "POLIPOP notify\-send 'hello pop'" hello bar
$ polifypop polifyModule1
.fi
.RE
.PP
\fB\fCpolifymodetoggler.sh\fR
.PP
.RS
.nf
#!/bin/bash
thisscript="$(readlink \-f "$0")"
if [[ $(polify \-\-module polifyModule1 | head \-1) = mode1 ]]; then
polify \-\-module polifyModule1 \\
\-\-leftclick "$thisscript" \\
\-\-foreground '#00FF00' \\
\-\-msg "mode2" \\
this is mode two
else
polify \-\-module polifyModule1 \\
\-\-leftclick "$thisscript" \\
\-\-foreground '#FF0000' \\
\-\-msg "mode1" \\
this is mode one
fi
.fi
.RE
.PP
If you are using multiple polybars you can use
the \fB\fC\-\-pid PID\fR option to specify which polybar
process to work with.
.SH OPTIONS
.PP
\fB\fC\-\-module\fR|\fB\fC\-o\fR TARGET\-MODULE
.br
Name of target module
.PP
\fB\fC\-\-pid\fR|\fB\fC\-p\fR PID
.br
If set the specified polybar PID process will be
used.
.PP
\fB\fC\-\-foreground\fR|\fB\fC\-f\fR COLOR
.br
Hexadecimal color value for MESSAGE foreground
color.
.PP
\fB\fC\-\-background\fR|\fB\fC\-b\fR COLOR
.br
Hexadecimal color value for MESSAGE background
color.
.PP
\fB\fC\-\-leftclick\fR|\fB\fC\-l\fR COMMAND
.br
COMMAND will get executed when MESSAGE is
left\-clicked
.PP
\fB\fC\-\-rightclick\fR|\fB\fC\-r\fR COMMAND
.br
COMMAND will get executed when MESSAGE is
right\-clicked
.PP
\fB\fC\-\-middleclick\fR|\fB\fC\-m\fR COMMAND
.br
COMMAND will get executed when MESSAGE is
middle\-clicked
.PP
\fB\fC\-\-scrollup\fR|\fB\fC\-u\fR COMMAND
.br
COMMAND will get executed when MESSAGE is
scrolled up.
.PP
\fB\fC\-\-scrolldown\fR|\fB\fC\-d\fR COMMAND
.br
COMMAND will get executed when MESSAGE is
scrolled down.
.PP
\fB\fC\-\-prefix\fR|\fB\fC\-e\fR STRING
.br
PREFIX text
.PP
\fB\fC\-\-foreground\-prefix\fR|\fB\fC\-F\fR COLOR
.br
Hexadecimal color value for PREFIX foreground
color.
.PP
\fB\fC\-\-background\-prefix\fR|\fB\fC\-B\fR COLOR
.br
Hexadecimal color value for PREFIX background
color.
.PP
\fB\fC\-\-leftclick\-prefix\fR|\fB\fC\-L\fR COMMAND
.br
COMMAND will get executed when PREFIX is
left\-clicked
.PP
\fB\fC\-\-rightclick\-prefix\fR|\fB\fC\-R\fR COMMAND
.br
COMMAND will get executed when PREFIX is
right\-clicked
.PP
\fB\fC\-\-middleclick\-prefix\fR|\fB\fC\-M\fR COMMAND
.br
COMMAND will get executed when PREFIX is
middle\-clicked
.PP
\fB\fC\-\-scrollup\-prefix\fR|\fB\fC\-U\fR COMMAND
.br
COMMAND will get executed when PREFIX is scrolled
up.
.PP
\fB\fC\-\-scrolldown\-prefix\fR|\fB\fC\-D\fR COMMAND
.br
COMMAND will get executed when PREFIX is scrolled
down.
.PP
\fB\fC\-\-expire\-time\fR|\fB\fC\-t\fR SECONDS
.br
If set module will get cleared after SECONDS
.PP
\fB\fC\-\-msg\fR|\fB\fC\-s\fR MESSAGE
.br
Will get added to the module text file before the
actual message/prefix. Can be used to store
information such as the current state of the
module
.PP
\fB\fC\-\-clear\fR|\fB\fC\-x\fR
.br
Clears the module.
.PP
\fB\fC\-\-help\fR|\fB\fC\-h\fR
.br
Show help and exit.
.PP
\fB\fC\-\-version\fR|\fB\fC\-v\fR
.br
Show version and exit.
.SH ENVIRONMENT
.PP
\fB\fCPOLIFY\_DIR\fR
.br
Path to a directory where polify keeps module
state. defaults to: /tmp/polify
.SH DEPENDENCIES
.PP
\fB\fCbash\fR \fB\fCpolybar\fR \fB\fCgetopt\fR
.PP
budRich https://github.com/budlabs/polify
\[la]https://github.com/budlabs/polify\[ra]
.SH SEE ALSO
.PP
bash(1), polybar(1),