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

feat: add command for setting window size to a specific value #268

Merged
merged 8 commits into from
Mar 4, 2023

Conversation

maxle5
Copy link
Contributor

@maxle5 maxle5 commented Feb 23, 2023

Objective:

The resize command currently supports increasing/decreasing a window by a a certain value, however it does not currently support setting a window height/width to a specific value (e.g. set width to 25%, or set height to 500px)

Solution:

  • Created a new SetWindowSize command
    • This calculates the delta/offset required to achieve the desired size, then invokes the resize command
  • Refactored resizeAmount parsing logic to to a new service ResizeParsingService, this is used to parse the resize amount (i.e. translate "+3%" to 0.03)
  • Updated readme to include set width/height command

@maxle5 maxle5 changed the title feat: support absolute resize values feat: support setting a window size to a specific value Feb 23, 2023
@maxle5 maxle5 marked this pull request as ready for review February 23, 2023 02:17
@lars-berger
Copy link
Collaborator

Thank you for this 👍 The code looks squeaky clean

However, one concern is we'd essentially have 2 distinct commands disguised as one. IMO it'd be better to just move this stuff to its own command eg. set height 400px

@maxle5
Copy link
Contributor Author

maxle5 commented Feb 23, 2023

@lars-berger, Ok I can do that! Do we have any concerns with set <height | width > 400px being similar to the existing set <floating | tiling | minimized | maximized> command?

@lars-berger
Copy link
Collaborator

@maxle5 I reckon it's fine - there's bound to be commands that have the same verb (eg. we currently have resize <height | width> ... and resize borders ...)

@maxle5
Copy link
Contributor Author

maxle5 commented Feb 23, 2023

@lars-berger, should be ready to be reviewed again, let me know if there is anything else you'd like me to change!

@lars-berger lars-berger merged commit abb758d into glzr-io:master Mar 4, 2023
@lars-berger lars-berger changed the title feat: support setting a window size to a specific value feat: add command for setting window size to a specific value Mar 4, 2023
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.

None yet

2 participants