Jump to content

Window management automation task doesn't move topmost window like intended


Recommended Posts

 

I've setup a simple keyboard trigger to invoke "Set Window Bounds from Preset", snapping the topmost window's bounds to the left half of the active screen. This sometimes works, other times not.
 
Some issues stand out:
 
1. Sometimes the topmost window (or at least the one that was clicked/activated last) doesn't move at all when the keyboard trigger is invoked
2. Sometimes some other unrelated window will move to the left half when the keyboard trigger is invoked (see this video where a tooltip window moves)
3. Sometimes the window moves a little bit to the left. Invoking the same keyboard trigger moves the window a little bit further. After X invocations, the window ends up in the left half...
4. Sometimes, there's a Javascript error when invoking the keyboard trigger (see this video)
 
~/Library/Application%20Support/Alfred/Automation/Tasks/com.alfredapp.automation.core/window-management/window-bounds.js
[11:01:07.993] ERROR: Move frontmost window[Automation Task] Task Error: ../window-bounds.js: execution error: Error: TypeError: undefined is not an object (evaluating 'screen.visibleFrame') (-2700)


Some other things come to mind:

 

- I've seen similar issues when trying to use Hammerspoon's window manipulation features

- I've not experienced any such issues when using Rectangle.app's window manipulation features

 

Details on macOS/Alfred:

 

- Alfred.app version: Alfred 5.0 GM1 (Build 2057)

- Alfred Tasks version: 2022.4

- macOS version: 12.4 (21F79)

 

 
Edited by arrelid
Link to comment
Share on other sites

Welcome @arrelid, and thank you for the thorough report.

 

9 hours ago, arrelid said:

2. Sometimes some other unrelated window will move to the left half when the keyboard trigger is invoked (see this video where a tooltip window moves)

 

That one was funny to watch. I have a fix for it which so far seems reliable. It’s out now in Automation Tasks 2022.6.

 

9 hours ago, arrelid said:
1. Sometimes the topmost window (or at least the one that was clicked/activated last) doesn't move at all when the keyboard trigger is invoked

 

I suspect it might be related to 2. I.e. it’s indeed moving something, just not what you want or can see.

 

9 hours ago, arrelid said:

3. Sometimes the window moves a little bit to the left. Invoking the same keyboard trigger moves the window a little bit further. After X invocations, the window ends up in the left half...

 

A video of that one would be helpful too. If I see how it’s behaving, it should help me reason about it in the code. Does it only happen when moving windows to the Left Half? What about e.g. Right Half or Left Two Thirds?

 

9 hours ago, arrelid said:

4. Sometimes, there's a Javascript error when invoking the keyboard trigger (see this video)

 

This one I haven’t been able to reproduce yet, but it’s conceivable it’s also related to 2.

 

Could you tell me a bit more about your setup? Specifically:

  • What keyboard shortcut are you using? I’m guessing it includes ctrl, judging by the “Display a menu” in Safari.
  • Do you have more than one monitor?

Link to comment
Share on other sites

13 hours ago, vitor said:

Welcome @arrelid, and thank you for the thorough report.

 

 

That one was funny to watch. I have a fix for it which so far seems reliable. It’s out now in Automation Tasks 2022.6.

 

Updated to Automation Tasks to 2022.6. Works better indeed - Alfred does seem to move the correct window now (i.e the window I thought it would move).

 

13 hours ago, vitor said:

A video of that one would be helpful too. If I see how it’s behaving, it should help me reason about it in the code. Does it only happen when moving windows to the Left Half? What about e.g. Right Half or Left Two Thirds?

 

I've only tried the snap to left task, so can't speak for any others. That said, here's a video where I have to invoke the same workflow multiple times before the window finally snaps to the left half.

 

I haven't been able to come up with solid steps to reproduce this, but it does seem to trigger quite often post any resize/move operation performed by SkyRocket (I tend to prefer this when resizing/moving windows using the mouse/trackpad - if you ever used Zooom/2, you should be familiar with this kind of window manipulation).

 

13 hours ago, vitor said:

Could you tell me a bit more about your setup? Specifically:

  • What keyboard shortcut are you using? I’m guessing it includes ctrl, judging by the “Display a menu” in Safari.
  • Do you have more than one monitor?

 

Keyboard shortcut: Ctrl + Opt + Shift + O

Monitors: The bug can be reproduced without any external monitors attached. That said, I usually have a monitor attached when using the computer at my desk.

 

Happy to help debug this further - just let me know how :)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...