zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
19.46k stars 613 forks source link

Support xterm focus reporting #3278

Open zolrath opened 2 months ago

zolrath commented 2 months ago

Hey hey, still loving zellij, great work on the newest update!

Issue

xterm compatible consoles emits FocusIn/FocusOut event sequences which are used by various CLI apps, but these events are swallowed up by zellij.

For example, in my vim settings I sync with the system clipboard only when the terminal gains/loses focus to speed up pasting dramatically:  

-- sync with system clipboard on focus
vim.api.nvim_create_autocmd({ "FocusGained" }, {
  pattern = { "*" },
  command = [[call setreg("@", getreg("+"))]],
})

-- sync with system clipboard on focus
vim.api.nvim_create_autocmd({ "FocusLost" }, {
  pattern = { "*" },
  command = [[call setreg("+", getreg("@"))]],
})

When using my terminal (in this case WSL Ubuntu in WezTerm on Windows) normally clipboard syncing works as expected without zellij.

Request

I'd love for zellij to both emit these events:

  1. When the terminal itself gains/loses focus.
  2. When the current pane loses focus via changing tabs or panes.

Thanks again!

imsnif commented 2 months ago

So, Zellij does support these and emits them when focus is changed between panes but I now checked and indeed it does not when focus is gained/lost from the current terminal window. Would be a good addition!