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
#!/usr/bin/env python3
"""Example par-term action-contributor plugin: a greeter.
Declares one palette action, ``greet``. par-term delivers an invocation as
one NDJSON line on stdin — ``{"kind": "plugin_action_invoked", "data":
{"data_type": "PluginActionInvoked", "action": "greet"}}`` — and each
``greet`` invocation appends ``<iso-timestamp> greeting`` to ``stamps.txt``
next to this script; events naming any other action id are ignored (the
routing pattern a multi-action plugin copies). par-term closes the plugin's
stdin on stop; EOF exits cleanly (PLUGINS.md's shutdown contract).
The manifest also declares ``subscriptions: ["bell_rang"]``, making this the
reference for plugin event subscriptions: every terminal bell in any tab of
the window arrives on stdin as
``{"kind": "bell_rang", "data": {"data_type": "Empty"}}`` and appends
``<iso-timestamp> bell`` to ``stamps.txt``. Trigger one with
``printf '\\a'``. An empty or absent ``subscriptions`` would mean
self-scheduled — no terminal events at all.
The plugin writes nothing to stdout: its effects are its own process's, by
design — an action that wants something done does it itself rather than
asking the host to (design D4).
Install (see docs/features/PLUGINS.md):
cp -r scripts/examples/plugins/com.example.greeter \
~/.config/par-term/plugins/
then enable it in Settings > Automation > Plugins. The action appears in
the command palette as "Greet · Greeter" and can be bound in config.yaml:
keybindings:
- key: "Ctrl+Alt+G"
action: "plugin-action:com.example.greeter:greet"
"""
= . /
=
=
continue
=
continue
=