-
-
Notifications
You must be signed in to change notification settings - Fork 893
feat(zellij-utils): Add source client_id to pipe messages
#4094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hey, thanks for this and good find. I think it makes sense all in all, but I'd rather not add the cli_client_id, since it's misleading (these clients are usually extremely short lived and don't have many of the other guarantees clients have). We could do this by making the field optional in the protobuf declaration. Also, if you'd like you can add the |
|
Yeah, to be honest, I hesitated to do it :-P I noticed that a cli client connection doesn't trigger the You think I should add the The addition of the |
e3e06d9 to
fb473aa
Compare
|
@imsnif I've updated the PR to only send the Since I'm already modifying the protobuf, perhaps we can merge #4095 into this PR ? Since it's already a breaking change, we can take the opportunity to clean up this. |
|
Hey, from a cursory look this seems fine - thanks! I appreciate the thought with the protobuffs in xtask, but I'd rather not conflate things. Can we remove it for now? As for the |
|
Ok I see :-) Actually It seems I can use the For the xtask thing, sure I will remove it. Do you want me to open a new PR for it ? After testing, it seems the PaneId is not set for |
fb473aa to
d9bce5a
Compare
|
Humm it seems that's really not that easy to know which pane is focused when the |
|
@imsnif May I ask you if you have time to take a new look at this PR ? |
|
My apologies, I am juggling a lot of things and am merely Human. Best bet is to try to make this change as small and concise as possible so that I can review and merge it in one go. I'll try to take a look in the next few weeks. Thanks for understanding. |
a265c45 to
f4b7497
Compare
|
No problem, I fully understand that :-) Maintaining alone this kind of project is not an easy task! I've cleaned up the PR. The changes should be as minimal as I can think about. |
2dc8335 to
f07f1d9
Compare
|
@imsnif Apologies for the ping here, I've rebased my PR and made sure it includes only the most minimal changes possible. It's just passing adding the |
Adds a the `client_id` of the client being the source of the pipe message. This allows to take action in the currently focused pane or tab from the perspective of the client which sent the pipe message.
f07f1d9 to
4b8d87b
Compare
imsnif
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your patience! I'll get the CI to run the tests and I also left some comments.
| std::thread::sleep(std::time::Duration::from_millis(500)); | ||
|
|
||
| let _ = plugin_thread_sender.send(PluginInstruction::CliPipe { | ||
| pane_id: None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's maybe make one of these a Some for the sake of completeness in the tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just one with a fake PaneId::Terminal ?
Or perhaps tow, one PaneId::Terminal and one PaneId::Plugin ?
|
Thanks for the review! |
|
By the way I don't know if you want me to clean up the commit history or if you usually squash on merge? |
Proposal
Description
Adds a the
client_idof the client being the source of the pipe message.Problem
I want to create a plugin that allows to write chars to a specific pane based on it's name.
For this, I want my plugin to react to a pipe message (which can be sent from the CLI or a KeyBind), then tries to find a pane with a matching title in the focused tab.
But, since a pipe message is always sent to all clients, even when it is triggered by a KeyBind, I can't know which tab is focused by the client how sent the KeyBind.
Solution
Add the source
client_idto thePipeMessagestructure when it's triggered by a KeyBind or a Plugin, or apane_idwhen it comes from the CLI.The
pane_idfor the CLI pipes is needed because the CLI client doesn't work exactly like a normal client, so it's not possible to keep track of it inside plugins. With the terminalpane_id, I still can know from which tab it comes.With the source
client_idandpane_id, my plugin can know from which tab the pipe message was sent by keeping track of which tab each client is currently focusing.