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

[Question/Bug?] Exiting with a key/mouse press #21

Open
kfernandez31 opened this issue Oct 4, 2024 · 8 comments
Open

[Question/Bug?] Exiting with a key/mouse press #21

kfernandez31 opened this issue Oct 4, 2024 · 8 comments

Comments

@kfernandez31
Copy link

kfernandez31 commented Oct 4, 2024

Environment:

  • OS: MacOS Sequoia 15.0 (24A335)
  • zsh: zsh 5.9 (arm64-apple-darwin24.0)

Currently, pressing any key will just kill the shell that's running the screensaver. This is probably not the intended behavior, correct? It'd be nice for any key (or mouse) press to bring one back to the original shell, unaffected by the screensaver daemon.

@HarshalRathore
Copy link

this same is happening with me i use zsh and tmux and pressing any key closes the windows or shell or tmux I am not sure which it is closing. here is a recording

Screencast.From.2024-10-05.00-16-40.webm

@cxreiff
Copy link
Owner

cxreiff commented Oct 4, 2024

Oh, odd. I'm developing on Sequoia/Zsh so I'm unsure why the behavior would be different. I'll dig into this and see if I can fix it with the existing command, but if not it should be easy for me to add an option that just creates an inner shell first.

@cxreiff
Copy link
Owner

cxreiff commented Oct 4, 2024

Can I ask which terminal emulator you use?

@kfernandez31
Copy link
Author

Mine's iTerm2 v. 3.5.5.

@HarshalRathore
Copy link

HarshalRathore commented Oct 5, 2024

@cxreiff Hii,
For me it's
Kitty(latest version), zsh(with zinit and latest version) and tmux(latest version)

@kfernandez31
Copy link
Author

Hello @cxreiff, any updates ?

@cxreiff
Copy link
Owner

cxreiff commented Nov 26, 2024

So its difficult for me to know for sure as I've been unable to recreate this myself, but I asked around and I do have some things you could try for us to identify the cause.

  1. Do either of you use zsh extensions/plugins? I talked to one person who had zsh extensions set up (fast-syntax-highlighting or zsh-autosuggestions) and those interfered with this TMOUT technique. If you start a zsh shell with no customizations using zsh --no-rcs, then run the command TMOUT=5; trap "ttysvr; zle reset-prompt" ALRM does it still kill your shell afterward?

  2. It could be that on my end, either the screensaver command or the "zle reset-prompt" are resetting the timeout timer, but for you they aren't. If you run TMOUT=5; trap "ttysvr; TMOUT=0; TMOUT=5; zle reset-prompt" ALRM does it work? Or TMOUT=5; trap "echo test; ttysvr; echo test; zle reset-prompt" ALRM?

The only code in this repo that has anything to do with this is the TMOUT=5; trap "ttysvr; zle reset-prompt" ALRM shell command that the --init option generates, so it almost definitely is to do with something in your .zshrc.

@HarshalRathore
Copy link

Hi @cxreiff,

Thank you for your suggestions and insights. I followed the first point you mentioned, and as you suspected, the issue was related to my shell customizations. Starting the zsh shell with the --no-rcs option resolved the problem—when I press any keystroke, the shell session persists and does not exits.

In my configuration, I had the plugins fast-syntax-highlighting, zsh-autosuggestions, zsh-completion, and zsh-history-substring-search. This confirms that the first two plugins are the primary cause of this unusual behavior. However, I am unsure if the latter two also contribute to the issue. For reference, I’ve linked my .zshrc file here.

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