Skip to content
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

Failed to check if the command running in the current pane is helix #17

Closed
lens0021 opened this issue Aug 28, 2024 · 24 comments
Closed

Comments

@lens0021
Copy link

lens0021 commented Aug 28, 2024

if echo "$RUNNING_COMMAND" | grep -q "/hx$"; then
is always false for me.

When I tested, zellij action list-clients is:

CLIENT_ID ZELLIJ_PANE_ID RUNNING_COMMAND
1         terminal_1     hx /some/path -w /some/path

so

$ echo hx | grep -q "/hx$"; echo $?
1
$ echo hx | grep -q "hx$"; echo $?
0

for me.

  • zellij 0.40.1
  • grep (GNU grep) 3.11
  • helix 24.7 (079f5442) installed using dnf
  • Fedora Workstation
@lens0021 lens0021 changed the title Failed the check if the command running in the current pane is helix Failed to check if the command running in the current pane is helix Aug 28, 2024
@luccahuguet
Copy link
Owner

thanks, will look into it

@luccahuguet
Copy link
Owner

did it fail all times or only some times?

@luccahuguet
Copy link
Owner

was the helix pane next to the yazi pane?

to the right of the yazi pane?

@lens0021
Copy link
Author

Hm, here are reproduction steps:

git clone --depth 1 https://github.com/luccahuguet/yazelix.git
cd yazelix
zellij --config-dir zellij options --layout-dir zellij/layouts
Screencast.from.2024-08-29.11-32-33.webm

did it fail all times or only some times?

sometimes it success, but I does not know when

@mohsini172
Copy link

I had the same issue #18
Didn't understand this issue before opening #18 so closed it now.

@lens0021
Copy link
Author

lens0021 commented Oct 4, 2024

Today, I cannot reproduce this by the mentioned method:

git clone --depth 1 https://github.com/luccahuguet/yazelix.git
cd yazelix
zellij --config-dir zellij options --layout-dir zellij/layouts
Screencast.from.2024-10-04.12-13-14.webm

I don't know what are differences

@luccahuguet
Copy link
Owner

Today, I cannot reproduce this by the mentioned method:

git clone --depth 1 https://github.com/luccahuguet/yazelix.git
cd yazelix
zellij --config-dir zellij options --layout-dir zellij/layouts

Screencast.from.2024-10-04.12-13-14.webm
I don't know what are differences

This is good, I guess.

But nevertheless, I'll be switching the script from bash to nushell, and make it more sensible to detecting hx so it should fail much less

@luccahuguet
Copy link
Owner

#20

@luccahuguet
Copy link
Owner

presumably fixed by #21

will re-open if anyone can reproduce this on v4.1

@lens0021
Copy link
Author

lens0021 commented Oct 6, 2024

Again happens.

Screencast.from.2024-10-06.09-47-09.webm

Maybe it's because the machines I used are differences, but I am not sure.

In any case, I've found an issue about zellji's list-clients zellij-org/zellij#3639
It will be good if using zellij action dump-layout instead, but its output is in kdl format, and it seems there is no actively maintained kdl parsing CLI.

@luccahuguet
Copy link
Owner

Thank you

i cannot reproduce, but will look into dump-layout...

@luccahuguet luccahuguet reopened this Oct 6, 2024
@luccahuguet
Copy link
Owner

can you try this again running nushell?

@lens0021
Copy link
Author

lens0021 commented Oct 6, 2024

Changed the default shell to nushell by using chsh and logout, but same.

To debug, I've added the next lines:
(edited)

echo $"(zellij action list-clients)\n" | save --append ~/.config/yazelix/log
echo $"running_command: ($running_command)\n\n" | save --append ~/.config/yazelix/log

And here are the logs:

CLIENT_ID ZELLIJ_PANE_ID RUNNING_COMMAND
1         terminal_1     /usr/bin/hx /home/nemo/.config/yazelix/README.md
running_command: /home/nemo/.config/yazelix/README.md

@lens0021
Copy link
Author

lens0021 commented Oct 6, 2024

And zellij action list-clients | detect columns is [{CLIENT_ID: 1, ZELLIJ_PANE_ID: terminal_1, RUNNING_COMMAND: /usr/bin/hx, RUNNING_COMMAND: /home/nemo/.config/yazelix/README.md}]. I am not aware of nushell, so I don't know why the same keys exist in a list.

(edited)

@luccahuguet
Copy link
Owner

I see... funky business..

try this:

    let list_clients_output = (zellij action list-clients | lines | get 1)

    # Check if the command running in the current pane is hx
    if (is_hx_running $list_clients_output) {

if it works, I'll update the code

@lens0021
Copy link
Author

lens0021 commented Oct 7, 2024

It perfectly works, thank you!

@luccahuguet
Copy link
Owner

It perfectly works, thank you!

awesome! I will further refine it before updating the code

hopefully I'll still count on your testing before committing the change

@luccahuguet
Copy link
Owner

allright, i've commited some code to the main branch

should be working now

if it is, i will close this

@mohsini172
Copy link

I will also test it out and will let you know.

@luccahuguet
Copy link
Owner

I will also test it out and will let you know.

Hello @mohsini172 ,

I am curious about whether the bug fix worked properly.. Did you get to try it?

@mohsini172
Copy link

I just tested it with nu and now it works

@luccahuguet
Copy link
Owner

I just tested it with nu and now it works

Cool thanks, what about you @lens0021 ?

@lens0021
Copy link
Author

LGTM

@luccahuguet
Copy link
Owner

LGTM

Awesome! I am then closing this issue.

This will be the last time I commit directly to main..

I will create contributing guidelines and add them to the readme

thanks for the help everyone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants