Skip to content

Commit 83bcdd0

Browse files
committed
Update README.md documentation with bit on command_sender injection
1 parent 286c92d commit 83bcdd0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ def handle_will_appear(event_data):
8787

8888
!!!INFO Handlers for action-specific events are dispatched only if the event is triggered by the associated action, ensuring isolation and predictability. For other types of events that are not associated with a specific action, handlers are dispatched without such restrictions.
8989

90+
Handlers can optionally include a `command_sender` parameter to access Stream Deck command sending capabilities.
91+
92+
```python
93+
@my_action.on("willAppear")
94+
def handle_will_appear(event_data, command_sender: StreamDeckCommandSender):
95+
# Use command_sender to interact with Stream Deck
96+
command_sender.set_title(context=event_data.context, title="Hello!")
97+
command_sender.set_state(context=event_data.context, state=0)
98+
```
99+
100+
The `command_sender` parameter is optional. If included in the handler's signature, the SDK automatically injects a `StreamDeckCommandSender` instance that can be used to send commands back to the Stream Deck (like setting titles, states, or images).
101+
90102

91103

92104
### Writing Logs
@@ -234,7 +246,7 @@ Contributions are welcome! Please open an issue or submit a pull request on GitH
234246
The following upcoming improvements are in the works:
235247

236248
- **Improved Documentation**: Expand and improve the documentation with more examples, guides, and use cases.
237-
- **Bind Command Sender**: Automatically bind `command_sender` and action instance context-holding objects to handler function arguments if they are included in the definition.
249+
- **Store & Bind Settings**: Automatically store and bind action instance context-holding objects to handler function arguments if they are included in the definition.
238250
- **Optional Event Pattern Matching on Hooks**: Add support for optional pattern-matching on event messages to further filter when hooks get called.
239251
- **Async Support**: Introduce asynchronous features to handle WebSocket communication more efficiently.
240252

0 commit comments

Comments
 (0)