nut.js icon indicating copy to clipboard operation
nut.js copied to clipboard

Set position and size of windows?

Open NL33 opened this issue 3 years ago • 5 comments

Short summary

Is it possible to use NutJS to not only retrieve the size and position of a window, but also set the size and position of a window?

Desired execution environment / tested on

  • [ ] Virtual machine
  • [ ] Docker container
  • [X ] Dev/Host system

Detailed question

With the window functionality of nut.js, you can get the size and position of open windows on the screen. Is it possible to set the size and position of windows on the screen?

My guess is this functionality is not available out of the box, but I am inquiring here to see if it would be possible either with some modification or in combination with another library.

One way would be if you could wrap selected windows in an application window. For instance, in an electron app, wrap an electron window over selected windows on the user's screen. Then you could control the size and position through the electron app. Given nut.js's ability to access items from the user's machine, I thought perhaps it could be relevant for this.

Thanks again for the great work.

NL33 avatar May 20 '21 11:05 NL33

Hi @NL33 👋

this is definitely doable. However, nut.js lacks the required implementation. So far there’s no proper definition of what to support, this would be a first thing to do.

Best regards

Simon

s1hofmann avatar May 23 '21 05:05 s1hofmann

Thanks. I'm happy to not have nut.js do this, if there are cross-platform alternative ways available. Do you happen to know of any?

In this case, the best for my use case would be to be able to open a selected window within my electron app window.

Note that this is not just displaying a view of the window (which could be possible now), but allowing the user to open an application (like, say, a txt file), and having my electron app wrap around that txt file. So the user could still interact with the file in the same way as always (editing text, etc)., but now it's in an electron window, and I can control the size and position from there.

With an iframe, this works in some cases, but not most. The goal would be to allow it for for any type of application window.

Or, perhaps, if wrapping in an electron window is not the best way, than setting the size and position of a given window another way.

NL33 avatar May 23 '21 13:05 NL33

Just a quick follow-up on this. To clarify: what would you require for implementing in nut.js? (right now there is the stated goal: for a given window, provide the option to set the size and position of that window.)

If implementing through nut.js would take awhile (which would be totally understandable), are there other solutions out there to come close to this functionality in the meantime?

Thanks very much.

NL33 avatar May 28 '21 00:05 NL33

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Apr 27 '22 02:04 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 12 '22 02:05 github-actions[bot]

Closed with release 4.0.0

s1hofmann avatar Feb 20 '24 20:02 s1hofmann