cxreiff / ttysvr

Screensavers for your terminal.
Apache License 2.0
401 stars 7 forks source link

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

Open kfernandez31 opened 1 month ago

kfernandez31 commented 1 month ago

Environment:

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

Can I ask which terminal emulator you use?

kfernandez31 commented 1 month ago

Mine's iTerm2 v. 3.5.5.

HarshalRathore commented 1 month ago

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

kfernandez31 commented 4 days ago

Hello @cxreiff, any updates ?

cxreiff commented 4 days ago

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 commented 3 days ago

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.