fresh2dev / zellij-autolock

autolock Zellij when certain processes open.
MIT License
58 stars 2 forks source link

Terminal flashing #3

Closed steakhutzeee closed 5 days ago

steakhutzeee commented 6 months ago

Hi, I'm experiencing terminal flashing.

As an example if I hit Ctrl-f (my alternative binding for fzf's Alt-c) the terminal flashes continuously, stopping when I hit Esc, terminating fzf and returning in Normal mode.

The same if I use zi or Ctrl-r, the terminal flashes until the return in Normal mode.

Link to my config https://gist.github.com/steakhutzeee/f88fd14bc4f8a39f569c758b417df08b

Thank you!

fresh2dev commented 6 months ago

I suspect this is related to https://github.com/zellij-org/zellij/issues/1903#issuecomment-1587699810.

In short, it happens because we read the terminal output from the pty in an async loop. Due to the nature of said loop, we sometime get partial output that is fixed in the next render when we get more output.

Today, this plugin issues a Zellij CLI command -- zellij action list-clients -- to determine which command is running in the focused pane. In a future version of Zellij (when this capability is available via the Zellij API) I will refactor this plugin to use that instead of terminal commands. That should resolve the flickering issue that seems to occur when issuing terminal commands from a Zellij plugin.

It's worth noting that I have not encountered this issue myself. FWIW, I'm running Fedora 40 (Silverblue) and Alacritty v0.13.2. :shrug:

steakhutzeee commented 6 months ago

I see, I'm under WSL2 Ubuntu using Windows Terminal.

fresh2dev commented 6 months ago

I wonder if switching to Alacritty would make this issue go away. No saying that's a solution, but maybe a workaround until Zellij gets a bit more mature.

steakhutzeee commented 6 months ago

Just tried with portable version of Alacritty, I see the same flashing.

fresh2dev commented 6 months ago

Kk. Will have to reassess when a new version of Zellij offers list-clients functionality via the API.

theol0403 commented 2 months ago

Yeah, unfortunately the flashing is almost unbearable, for me it happens every time enter is pressed or pane is focused.

WSL Ubuntu, occurs with Wezterm and Alacritty.

https://github.com/user-attachments/assets/c98c9023-fe75-42e5-bfa3-15d2158c7a8f

fresh2dev commented 1 month ago

Oof, that is terrible. Seems to be specific to Windows. My setup works fine on Linux and MacOS.

theol0403 commented 3 weeks ago

The required API has been added! https://github.com/zellij-org/zellij/pull/3687

fresh2dev commented 2 weeks ago

Just published v0.2.0 of this plugin which takes advantage of the new Zellij API enhancements. Can someone confirm that this resolves the terminal flashing issue?

theol0403 commented 6 days ago

Seems to be working great for me!! Terminal still flashes when creating panes, but not when switching between them -- probably not your fault.

fresh2dev commented 5 days ago

Stellar; thanks.