I’m working on some tweaks to my current theme, and I would like to emulate something similar to the window snapping in windows 7.
I have the functions defined, but I’m not sure how to trigger them.
I would like to trigger these when I am dragging a window, and the cursor reaches the corresponding side of the screen.
Any recommendations on where to look for next steps?
Functions for reference
#####
# Miscellaneous Functions
#################
DestroyFunc AeroSnapLeft
AddToFunc AeroSnapLeft
+ I Move 0 0
+ I Maximize 50 100
+ I Raise
DestroyFunc AeroSnapRight
AddToFunc AeroSnapRight
+ I Maximize 50 100
+ I Move 50 0
+ I Raise
DestroyFunc AeroSnapTop
AddToFunc AeroSnapTop
+ I Maximize 100 50
+ I Move 0 0
+ I Raise
DestroyFunc AeroSnapBottom
AddToFunc AeroSnapBottom
+ I Maximize 100 50
+ I PipeRead "echo Move $(($[vp.y] + $[vp.height]/2)) $[vp.x]"
+ I Raise
You can’t do it whilst dragging the window because the pointer is grabbed. What you can do though is:
EdgeThickness 1
EdgeCommand ... SomeFunction
DestroyFunc SomeFunction
AddToFunc SomeFunction
+ I DoSomething
– Thomas Adam
Thanks for the reply.
Just to make sure, there’s no way to detect that the pointer is grabbed?
No way useful for you. It’s the wrong question to ask.
– Thomas Adam
Yeah, I was thinking it was.
Is there a right question to ask for this?
I had a new idea, but I’m just shy of putting together the right pieces.
On Edge Hit Start Checking to see if we are dragging a window
EdgeCommand Top WIDPreAeroSnapTop
First Check, do we have a focus on a window.(Something like this, doesn’t seem to work as is)
[code]DestroyFunc WIDPreAeroSnapTop
AddToFunc WIDPreAeroSnapTop
- I TestRc (NoMatch) Test PipeRead “echo $(($[w.id] == “$[w.id]”)) PosPreAeroSnapTop” [/code]
Next Check to see if the window position is at or past the screen edge
[code]DestroyFunc PosPreAeroSnapTop
AddToFunc PosPreAeroSnapTop
- I TestRc (Match) Test PipeRead “echo $(($[w.y] <= $[vp.y])) AeroSnapTop”[/code]
Then trigger the snap function
[code]DestroyFunc AeroSnapTop
AddToFunc AeroSnapTop
- I Maximize 100 50
- I Move 0 0
- I Raise[/code]
After playing around with a few things, I think I have a larger problem with this methodology.
The EdgeCommand doesn’t seem to trigger when I am moving a window.
Since the key to this was triggering the function when dragging the window to the edge of the screen I’m not sure how I can work around it and still get desired effect.
This won’t work. Stop trying to think it will.
I will update cvs with something to do this.