agzam / spacehammer

Hammerspoon config inspired by Spacemacs
MIT License
567 stars 70 forks source link

Fix Center Window #120

Closed jaidetree closed 3 years ago

jaidetree commented 3 years ago

NOTE: This PR depends on #118. Once that is merged, I'll rebase to reduce noise.

Fixes #119

Allows you to add something like the following to your config.fnl:

{
  ;; ...
        :modules {:windows  {:center-ratio "50:60"}}
  ;; ...
}

Then you can use the center-window-frame window modal action to use it like the following:

2021-09-12 19 09 24

Creates an advisable function called windows.position-window-center that takes the center-ratio config string and the target window. It is responsible for parsing the center-ratio string into numbers, and applying them to the target window. The advisable function gives users the option of overriding it to parse the center-ratio string in a different format and apply the calculation differently if needed.

If an option is not set, defaults to 80:50 which is a percentage of the screen. This is nearly identical to the previous version defaults.

jaidetree commented 3 years ago

Just rebased thanks for reviewing #118 Graz!

jaidetree commented 3 years ago

Closing in favor of #121 to stop using personal fork