dj95 / zjstatus

A configurable statusbar plugin for zellij
MIT License
358 stars 6 forks source link

feat: remote control zjstatus with pipes #48

Closed dj95 closed 2 months ago

dj95 commented 3 months ago

With the next release, zellij introduces pipes for plugins, which allow to pipe arbitrary data to plugins. This allows us to implement a handler, that picks up the lines piped to zjstatus, such that it will be able to receive some commands.

In the first iteration zjstatus will gain the capability to rerun command widgets by sending a specific string through the pipe. To send such a message, simply run zellij pipe "zjstatus::rerun::command_name" in the session where the command should be refreshed. Please note the appending specification for the protocol to communicate with zjstatus.

[!IMPORTANT] This pull request can only be merged as soon as zellij releases its new version!


Protocol description

As the name indicate, the protocol sends messages via lines. This means, that each line will try to be interpreted as one command. Each line has the following structure:

{{prefix}}::{{command}}::{{args}}

{{prefix}} is always zjstatus, such that zjstatus will be able to distinguish between messages for other plugins and itself. {{command}} is the command you want to transmit to zjstatus. As of now, only rerun is possible. The third part is variadic and can provide arguments to the command to run. In case of rerun it is the command name as written in the layouts (e.g. command_date).

Commands

rerun

Arguments command_name

Triggers a command run for the widget with the given name.

notify

Arguments message

Displays a notification with the given body in the notification widget.