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

Remember the last state of MicroPad window #42

Closed
AndrewMD888 opened this issue Oct 17, 2020 · 5 comments
Closed

Remember the last state of MicroPad window #42

AndrewMD888 opened this issue Oct 17, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@AndrewMD888
Copy link

This is a small but helpful feature - it would be handy if the program opened to the same window size/position upon start up that it had from the previous execution.

@NickGeek NickGeek added the enhancement New feature or request label Oct 17, 2020
@zoepicone
Copy link

zoepicone commented Apr 26, 2022

I can try working on this - seems like window.js in electron-boilerplate would be able to deal with this pretty easily

@NickGeek
Copy link
Member

@zoedelphi That works although by the looks of it, you could probably use the nodejs fs/promises package directly to store the setting as JSON or something. It looks small enough to implement that I think a whole lib might be overkill?

  1. If the file exists upon loading the app then parse it
  2. If error skip
  3. If it parses correctly then call the electron setSize function on BrowserWindow (https://www.electronjs.org/docs/latest/api/browser-window#winsetsizewidth-height-animate) to that value
  4. Add an event handler for the resize event to update and save that file asynchronously

@zoepicone
Copy link

@NickGeek I think the main issue would be dealing with resolution changes that could leave the window inaccessible due to being completely out of bounds - I was just thinking of using the single js file as nothing else in the lib is needed

@NickGeek
Copy link
Member

NickGeek commented Apr 27, 2022

@zoedelphi fair enough. As long as the licencing is okay with that file. You'll want to watch out for extra deps they pull in too. If you send in a PR I'll take a look.

@NickGeek
Copy link
Member

Fixed in v4

Repository owner moved this from Next Up to Done in MicroPad's DevBad so PlanHad Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

3 participants