Help with windowrule "move onscreen"

Hyprland version
Hyprcursor: built against 0.1.13, system has 0.1.13
Hyprlang: built against 0.6.7, system has 0.6.7
Aquamarine: built against 0.10.0, system has 0.10.0

Version ABI string: ea444c35bb23b6e34505ab6753e069de7801cc25_aq_0.10_hu_0.11_hg_0.5_hc_0.1_hlg_0.6
no flags were set

Describe your issue / feature…

Hi all,

before 0.53 I used to have this windowrule:

windowrule = move onscreen cursor -50% -50%, tag:floaty

basically to spawn windows at cursor while keeping it onscreen, how can I replicate it on 0.53? Wiki doesn’t seem to mention “onscreen” anymore, I tried blindly putting it everywhere but nothing seemed to work (it still spawns at cursor, but can go outside of screen).

Any alternative/working solution is appreciated

windowrule {
  name = Floaty
  float = on
  move = onscreen (cursor_x-(window_w*0.5)) (cursor_y-(window_h*0.5))
  match:tag = floaty
}

move = max(min(cursor_x-window_w,monitor_w-window_w),0) max(min(cursor_y-window_h,monitor_h-window_h),0)

thank you, this seems to work, didn’t know you can use expressions like that. I’ll tweak it a bit and it’ll be perfect