Encountering a possible bug with the Move a Window action

Hello all,

I have a fairly simple macro whose purpose is to "nudge" a window around with the arrow keys. Here's a simplified version that only does left and right movements.

Nudge Window.kmmacros (4.3 KB)

I've used various window manipulating macros for years but after upgrading to 11.0.2 a while back I noticed that this macro execution became noticeably sluggish. The macro is designed to repeatedly execute the move window action as long as the hotkey is down.

This behavior is snappy and fast up to version 11.0.1 but any version after, including the recently released 11.0.4, shows the sluggish behavior.

I'm attaching a couple of demo screen recordings appropriately titled "sluggish" and "snappy"

https://imgur.com/a/8nEoYCo

https://imgur.com/a/fX2A7lZ

Sluggish is using 11.0.4. Snappy is one 11.0.1

So, is this some quirk unique to my system or is this a bug or perhaps intended behavior for the Move a Window action?

This quirk/bug does present itself on 3 different Macs I've tried it on and has existed under both MacOS 14 and 15.

I'm currently running 15.5.

By turning on the debugger while executing your macro, I saw something disconcerting... a bug in your code. It's hard to explain, but the way you wrote your macro, you are generating multiple copies of it at the same time. Therefore one way to fix that bug, which may possibly fix your problem, is for you to add a semaphore at the start of your macro to prevent duplicate occurrences from running at the same time.

The semaphore should have values of 1 hundredth of a second, and the checkboxes turned off.

Let me know if that fixes your problem. And try turning on the debugger to see what's happening. I inserted the semaphore on my copy of your macro, and the macro changed its behaviour. However even with the improvement, I still think there's a flaw in the way you wrote this macro.

Even with @Airy's fix (which you should do!), I think you're still going to find it slower than you'd like, and that's due to this item in the 11.0.2 release notes:

  • Worked around an issue when setting window position and size when the system is animating the changes and gets confused.

This change was made due to a bug in macOS; there's a fair bit of discussion on it in the forums; this thread is probably the most relevant:

Included there is a Terminal command to disable the change (an added delay), so you might try that.

-rob.

2 Likes

Ok, I understand now. I've implemented @Airy's semaphore idea but (as prophecy foretold) my macro is still slow.

I'll take "fast and unreliable" for $200 Alex. Ie, I've used the defaults write mentioned in the linked thread to disable the delay introduced in 11.0.2.

Thanks for pointing me in the right direction!

SP Resize does this but not sure if it still works.