zellij-org / zellij

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

Support xterm focus reporting #3278

Open zolrath opened 7 months ago

zolrath commented 7 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 7 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!

roguesherlock commented 3 weeks ago

hey guys, loving zellij so far. I recently ran into this too. It's exactly as you say Aram, it does report when I'm switching between panes but not when terminal loses/gains focus.

I was wondering if this is planed in the near feature or out of scope for now. If It's easy enough to add maybe I can help you with this, could be a fun project to learn rust over holidays next month haha