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

Set the current terminal window size. #52830

Open
Zibri opened this issue May 4, 2024 · 4 comments
Open

Set the current terminal window size. #52830

Zibri opened this issue May 4, 2024 · 4 comments
Labels
feature request Issues that request new features to be added to Node.js. process Issues and PRs related to the process subsystem.

Comments

@Zibri
Copy link

Zibri commented May 4, 2024

What is the problem this feature will solve?

As we know, to get the actual window size, we can do:

process.stdout.on('resize', () => {
  console.log(`${process.stdout.columns}x${process.stdout.rows}`);
 }

As far as I know there is not the opposite: a way to set the window size programmatically.
Setting process.stdout.rows and process.stdout.columns sort of works but does not really change the window size.

What is the feature you are proposing to solve the problem?

process.stdout.setRows(40);
and
process.stdout.setColumns(80);

to physically resize the window (tty/pty).

What alternatives have you considered?

No response

@Zibri Zibri added the feature request Issues that request new features to be added to Node.js. label May 4, 2024
@RedYetiDev
Copy link
Member

AFAIK there isn't a way to do this natively, as different terminals support different operations

@Zibri
Copy link
Author

Zibri commented May 6, 2024

AFAIK there isn't a way to do this natively, as different terminals support different operations

node-pty can do that. but it would be great to have it in node. at least for the main terminals, windows, linux, macos, msys2, cygwin, etc.
afaik, only windows have some quirks.. everything else works fine. but node-pty is a pita ...

@RedYetiDev
Copy link
Member

node-pty uses custom native bindings. I am -1 on implementing new bindings to accommodate this feature, but I'm not the decider, so I'd love another opinion.

@RedYetiDev RedYetiDev added the process Issues and PRs related to the process subsystem. label May 6, 2024
@RedYetiDev
Copy link
Member

@nodejs/process WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. process Issues and PRs related to the process subsystem.
Projects
Status: Pending Triage
Development

No branches or pull requests

2 participants