Screenvisible Not Accounting for Dock


#1

I'm trying to move and resize a window to the upper right of my screen, while the dock is anchored to the right side. Every way I try this, the window aligns to the right screen edge, under the dock, instead of aligning to the dock edge. I've read a number of older posts, but am not sure what I'm doing wrong. my macro is:


(note the variables were just to see that KM is noting a difference between SCREEN and SCREENVISIBLE).

I'm getting:

I've also tried Peter's suggestion of x; SCREENVISIBLE(main,Right)-SCREENVISIBLE(main,Width)*25%, which I got from this thread:
How Do I resize a Window on My External Monitor?
but the results were the same. Am I missing something?


#2

My setting to resize window: Control+Option+HJKL, to be specific,I use Control+Option+H to resize window to left-half,Control+Option+L to right-half,Control+Option+J to bottom-half, Control+Option+K to top-half.

I set my dock to right(personally I set it bottom and auto-hide) and use my setting to test the bug, occasionally the window aligns to the right screen edge, under the dock. It do have some "pattern" to trigger the bug.

"the window aligns to the right screen edge, under the dock" only arised when I use Control+Option+L after using Control+Option+J to bottom-half or Control+Option+K to top-half.

Only if I use Control+Option+H to resize window to left-half, then use Control+Option+L to right-half, the window will align to the dock edge.

That's weird.


#3


#4

So interesting. Based on your post, I tried a work around where I added an action tofirst move the window to the left, then immediately followed by my existing action. That seems to fix it!

It’s not an ideal solve, but in execution I barely even notice it.

Thanks!


#5

Yeah, it's far from ideal. :joy:


#6

The system will generally bounce an accessibility window change that results in the window going off the screen (or behind the dock). So in this case it appears to be backfiring, probably when the window is wider that it will be after resizing. Keyboard Maestro makes efforts to work around this, but clearly it is not succeeding in this case.