MrKai77 / Loop

Window management made elegant.
GNU General Public License v3.0
5.29k stars 104 forks source link

🐞 Change Custom Width/Height Percentages from Int to Float #436

Closed bijanoviedo closed 3 days ago

bijanoviedo commented 1 week ago

Bug Description

I'm using the "Custom" feature to tile my windows into sixths:

remove-gap-in-window-layout

I'm getting annoying gaps between the windows since floats aren't accepted in the custom width/height fields: window-resize-options

I'd like to create a custom width/height percentage that can be a float instead of just an int to avoid these sorts of gaps. The current behavior is that typing a float (e.g. "33.333333") in this box forces the width percentage to an int.

Happy to solve this problem another way if you know of one!

Steps To Reproduce

  1. Open Loop > Keybindings > Add "Custom" > Click Size
  2. Under "Width", type "33.33333" and it'll be forced down to 33% which is (I'm guessing) the cause of those gaps

Expected Behavior

Floats like 33.3333% are allowed to allow extra precision and avoid gaps.

Actual Behavior

Only integer values for width/height percentages are allowed

Screenshots

No response

MacOS Version

14

Loop Version

1.0.0 (1030)

Additional Context

No response

Final Checks

MrKai77 commented 1 week ago

Hmm.. the value is stored as a float, and is only rounded in the UI. Can you reproduce this with other apps?

Soft-Bred commented 1 week ago

I'm using the "Custom" feature to tile my windows into sixths:

I actually have this and it seems fine (?)

000680@2x

000681@2x

Do you have gaps enabled?

MrKai77 commented 1 week ago

@bijanoviedo It may be because you are using a terminal app that is restricted to being resized in increments of your font size. I know you can disable this setting in iTerm2 etc, but I'm not sure if you can disable that in the system's Terminal.app.

mugoosse commented 1 week ago

I have the same setup and would also like to be able to specify a 1/3rd width instead of the rounded 33% which creates gaps between windows.

MrKai77 commented 1 week ago

@mugoosse as stated in my previous comment, values are not rounded to the nearest integer. They are kept as decimals within the app, but shown rounded in the UI. You can verify this by exporting your keybinds as JSON in the "Advanced" tab, then checking the decimal values yourself.

mugoosse commented 1 week ago

@mugoosse as stated in my previous comment, values are not rounded to the nearest integer. They are kept as decimals within the app, but shown rounded in the UI. You can verify this by exporting your keybinds as JSON in the "Advanced" tab, then checking the decimal values yourself.

I exported the key bindings and it saved a width of 33, not 33.33333 as I entered. I also tried entering 33,33333 with no different outcome.

This is the the key binding object:

{
    "anchor" : 2,
    "direction" : "Custom",
    "height" : 50,
    "keybind" : [
      124,
      126
    ],
    "name" : "Top right",
    "positionMode" : 0,
    "sizeMode" : 0,
    "unit" : 1,
    "width" : 33,
    "xPoint" : 10,
    "yPoint" : 10
  }

The keybindings are supposed to split my windows up in six equally sized frames of 1/3rd of the screen width and 1/2th of the screen height.

Maybe you can try achieving this on your end to see the behaviour as well? The outcome is that there's a 0.5% gap between the windows:

image

mugoosse commented 1 week ago

FYI, in the meantime I achieved what wanted by manually updating the width values to 33.33333 in the exported keybinds.json file and importing it as new config file.

MrKai77 commented 1 week ago

Hmm alright
I will look into this!

MrKai77 commented 3 days ago

Fixed! Will be on the latest prerelease within 24 hours :)

Soft-Bred commented 3 days ago

What was the issue 😭

MrKai77 commented 3 days ago

Looks like some sliders had decimal places disabled :p

Soft-Bred commented 3 days ago

Lolllll, weird