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

[Feature request] Support focus gain/loss events #558

Closed
ilyagr opened this issue Sep 11, 2022 · 6 comments
Closed

[Feature request] Support focus gain/loss events #558

ilyagr opened this issue Sep 11, 2022 · 6 comments

Comments

@ilyagr
Copy link

ilyagr commented Sep 11, 2022

Focus gain and loss events are supported by at least xterm, kitty, Chrome OS default terminal (based on hterm, I think), and tmux (which might support them to a large degree even if the parent terminal doesn't; I'm not 100% sure). They are nicely described in Vim help.

As of tcell 2.3.1 (sorry I didn't test a more recent version), if one forces focus events on with fmt.Print("\x1b[?1004h"), subsequent focus events each result in tcell sending two EventKey events (<a-[> then I or O). It would be nice if these events were supported by tcell directly.

@Consolatis
Copy link

Consolatis commented Sep 12, 2022

This would be extremely useful for applications like senpai (IRC client) to decide when to show desktop notifications or update internal read states. foot also supports focus notifications using the same flow.

@gdamore
Copy link
Owner

gdamore commented Sep 12, 2022

This is a good idea. I think its fairly widely supported. I haven't done it mostly because I didn't think there was a need for it, and I haven't had time, but as there is a good use case for it, I'll see if I can add it pretty soon.

@avlapp
Copy link

avlapp commented Nov 17, 2022

I support this request. I would like to start two similar file-manager applications in tmux and only highlight the selected item in a list if the application has focus.

@stefanhaller
Copy link

I would very much like to have this too. In lazygit this could be used to refresh the git state when receiving focus; many GUI git clients do this.

@stefanhaller
Copy link

I decided to give it a try, see #599. I'm still quite new to go, and I don't have much experience with terminal emulation, so please be gentle...

@gdamore
Copy link
Owner

gdamore commented Dec 10, 2023

This is fixed .. although not implemented for Windows yet. Try 2.7.0 out. A ticket requesting this for Windows is opened.

@gdamore gdamore closed this as completed Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants