Skip to content

Conversation

@goniz
Copy link
Contributor

@goniz goniz commented Nov 6, 2025

I went with keeping the control in the cli instead of internally in opentui.

Still got artifacts on the terminal on suspend hence the draft status.
wanted to get feedback early since it’s my first contribution here :)

Fixes #3737

@goniz
Copy link
Contributor Author

goniz commented Nov 6, 2025

@kommander Would love to get your feedback!

@kommander
Copy link
Collaborator

Thanks for looking into this! I think a provider is a bit much for this, it could be a command that can be bound with config keybinds? The command then can add the SIGCONT listener and remove it again on when resuming.

renderer.suspend in opentui currently does not fully remove all terminal modes. I need to expose some native methods to do that. So it needs some work in opentui itself. It's a little bit convoluted there currently, would need to take apart some methods and split them up and store some more state to properly implement a native suspend/resume.

Let me see what I can do there. You can have a look it you like. Basically

  • renderer.zig needs to expose suspend/resume via lib.zig and bind in zig.ts
  • then setupTerminal needs to be split to not run feature detection again
  • termina.zig needs to store the useKittyKeyboard flag, to optionally enable it again on resume (or get rid of that flag throughout the stack entirely, because there is a setter to enable/disable kitty so it doesn't need to be an option)
  • then for suspend it needs to call performShutdownSequence
  • and for resume needs to call the split out part of setupTerminal and then terminal.enableDetectedFeatures
  • then the typescript renderer.ts can call these methods on this.lib

Roughly.

@goniz
Copy link
Contributor Author

goniz commented Nov 6, 2025

Thanks for looking into this! I think a provider is a bit much for this, it could be a command that can be bound with config keybinds? The command then can add the SIGCONT listener and remove it again on when resuming.

renderer.suspend in opentui currently does not fully remove all terminal modes. I need to expose some native methods to do that. So it needs some work in opentui itself. It's a little bit convoluted there currently, would need to take apart some methods and split them up and store some more state to properly implement a native suspend/resume.

Let me see what I can do there. You can have a look it you like. Basically

  • renderer.zig needs to expose suspend/resume via lib.zig and bind in zig.ts
  • then setupTerminal needs to be split to not run feature detection again
  • termina.zig needs to store the useKittyKeyboard flag, to optionally enable it again on resume (or get rid of that flag throughout the stack entirely, because there is a setter to enable/disable kitty so it doesn't need to be an option)
  • then for suspend it needs to call performShutdownSequence
  • and for resume needs to call the split out part of setupTerminal and then terminal.enableDetectedFeatures
  • then the typescript renderer.ts can call these methods on this.lib

Roughly.

Will definitely try to convert to a command. Still figuring out the correct patterns here 👍🏻

I'll try to look at the zig code as well, but will get to it only next week :(

@goniz
Copy link
Contributor Author

goniz commented Nov 12, 2025

Current state using latest opentui (0.1.41):

Screen.Recording.2025-11-12.at.9.09.38.mov

@kommander
Copy link
Collaborator

I have the suspend/resume improvements coming in the next opentui version.

@goniz
Copy link
Contributor Author

goniz commented Nov 19, 2025

I have the suspend/resume improvements coming in the next opentui version.

👑👑

@goniz
Copy link
Contributor Author

goniz commented Nov 20, 2025

@kommander looks good!

sst/opentui#324

I'll rebase and test my changes once opentui is updated on dev

@goniz goniz marked this pull request as ready for review November 22, 2025 18:24
@goniz
Copy link
Contributor Author

goniz commented Nov 22, 2025

@kommander PR is ready and works with latest opentui 🙌🏻

@rekram1-node
Copy link
Collaborator

itll format when it's merged ignore failure

@rekram1-node rekram1-node merged commit 6afdb5c into sst:dev Nov 22, 2025
2 of 3 checks passed
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

Successfully merging this pull request may close these issues.

OpenTUI: ctrl-z background controls are broken

3 participants