# Alternative mouse binding with preserved aspect ratio while resizing

**URL:** <http://forum.hypr.land/t/alternative-mouse-binding-with-preserved-aspect-ratio-while-resizing/1612>\
**Category:** Ricing\
**Tags:** question, help, config\
**Created:** [May 21, 2026, 9:45am UTC](http://forum.hypr.land/t/alternative-mouse-binding-with-preserved-aspect-ratio-while-resizing/1612 "2026-05-21T09:45:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanjay](http://forum.hypr.land/letter_avatar_proxy/v4/letter/s/58956e/32.png) [@sanjay](http://forum.hypr.land/u/sanjay)\
**Post date:** [May 21, 2026, 9:45am UTC](http://forum.hypr.land/t/alternative-mouse-binding-with-preserved-aspect-ratio-while-resizing/1612/1 "2026-05-21T09:45:34Z")

</div>

How to make windows resizable with aspect ratio in version 0.55.

In previous version it was

```auto
bindm = $mainMod SHIFT, mouse:273, resizewindow 1

```

Now it should be configured as

```auto
local focused_keep_aspect = hl.window_rule({
    match = { focus = true },
    keep_aspect_ratio = true,
})

hl.bind(mainMod .. " + SHIFT + mouse:273",function()
        focused_keep_aspect:set_enabled(true)
        hl.dispatch(hl.dsp.window.resize())
end, { mouse = true })

hl.bind(mainMod .. " + mouse:273",function()
        focused_keep_aspect:set_enabled(false)
        hl.dispatch(hl.dsp.window.resize())
end, { mouse = true })

```

Is there any easier way to configure this.

---

<div class="post-metadata">

**Author:** ![MikeT3ch](http://forum.hypr.land/letter_avatar_proxy/v4/letter/m/e8c25b/32.png) [@MikeT3ch](http://forum.hypr.land/u/MikeT3ch)\
**Post date:** [May 23, 2026, 3:49am UTC](http://forum.hypr.land/t/alternative-mouse-binding-with-preserved-aspect-ratio-while-resizing/1612/2 "2026-05-23T03:49:47Z")

</div>

I think you can delete the local variable:

```lua
hl.bind(MainMod .. " + SHIFT + mouse:273", function()
    hl.window_rule({ match = { focus = true }, keep_aspect_ratio = true })
    hl.dispatch(hl.dsp.window.resize())
end, { mouse = true })

hl.bind(MainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })

```

---

<div class="post-metadata">

**Author:** ![sanjay](http://forum.hypr.land/letter_avatar_proxy/v4/letter/s/58956e/32.png) [@sanjay](http://forum.hypr.land/u/sanjay)\
**Post date:** [May 24, 2026, 3:20pm UTC](http://forum.hypr.land/t/alternative-mouse-binding-with-preserved-aspect-ratio-while-resizing/1612/3 "2026-05-24T15:20:11Z")

</div>

No it is not working, it does seem working until once you resize with `mainMod + SHIFT + mouse:273` the aspect ratio rule is permanently set, and normal resizing stops working and all focused windows start behaving like that.

I don’t know much about lua implementation done, but my current config works fine with no problems.

---

<div class="post-metadata">

**Author:** ![sanjay](http://forum.hypr.land/letter_avatar_proxy/v4/letter/s/58956e/32.png) [@sanjay](http://forum.hypr.land/u/sanjay)\
**Post date:** [May 24, 2026, 6:24pm UTC](http://forum.hypr.land/t/alternative-mouse-binding-with-preserved-aspect-ratio-while-resizing/1612/4 "2026-05-24T18:24:44Z")

</div>

I did find out instead of resetting every time using a release bind should simply work. This is annoying but, I have no other choice

```auto
local focused_keep_aspect = hl.window_rule({
    match = { focus = true },
    keep_aspect_ratio = true,
})

hl.bind(mainMod .. " + SHIFT + mouse:273",function()
	focused_keep_aspect:set_enabled(true)
	hl.dispatch(hl.dsp.window.resize())
end, { mouse = true })

hl.bind(mainMod .. " + SHIFT + mouse:273",function()
	focused_keep_aspect:set_enabled(false)
end, { mouse = true, release = true })

hl.bind(mainMod .. " + mouse:273",function()
	hl.dispatch(hl.dsp.window.resize())
end, { mouse = true })

```
