I’m trying to write a Cinnamon-like pseudo tiling function which makes use of the keyboard to quickly resize and move windows to and from various fixed positions, with window states 1-9 representing the positions as they would on a numpad I.E. 1 = lower-left corner; 9 = upper-right corner; 2 = bottom half of screen; 8 = top half of screen; 6 = right half of screen; 3 = bottom-right corner; etc.

In theory it should work like this:

WinKey + Arrow = Tiles window to given part of the screen (Another arrow moves window to next tiled position or untiles and returns window to original position, depending on given direction)

So far I am able put the windows into, and return to the original position from, positions 2, 4, 6, 8, I.E. all the “half screen” positions.

But I cannot reliably get the corner positions to work (1,3,7,9). Sometimes the windows go into those positions, sometimes not, and even if they do, it is not always the corner I designate, nor does it “come out” of the corner.

As an illustration, I can put the window into position 6 (right half of screen), and then move it down into position 3 (bottom-right corner), but then it just gets stuck there. Also, If I put a window into position 4 (left-half of screen) and move it down into position 1 (bottom-left of screen) it jumps to position 3 (bottom-right of screen). I can’t work out what is wrong.

(I have used ResizeMoveMaximize in order to have the ability to return the window to it’s original position, and have designated “State 5” to be used for all windows being tiled, so my other windows are not interfered with.)

Here are my functions]

DestroyFunc TileLeft

AddToFunc TileLeft

# if tiled and tiled left (up, middle or down) then do nothing

- I Current (State 5, State 1) Break
- I Current (State 5, State 4) Break
- I Current (State 5, State 7) Break

# If not tiled, tile left, give tiled state and tiled left state

- I Current (!State 5, !Maximized) ResizeMoveMaximize 50 100 0 0
- I Current (!State 5) State 4
- I Current (!State 5) State 5
- I TestRc (Match) Break

# If tiled right, then untile and remove tiled states

- I Current (State 5, State 6) Maximize False
- I State 6 False
- I State 5 False
- I TestRc (Match) Break

# If tiled up, then tile top-left

- I Current (State 5, State 8) Maximize False
- I State 8 False
- I State 7 True
- I Current (State 7) ResizeMoveMaximize 50 50 0 0
- I TestRc (Match) Break

# If tiled bottom, then tile bottom-left

- I Current (State 5, State 2) Maximize False
- I State 2 False
- I State 1 True
- I Current (State 1) ResizeMoveMaximize 50 50 0 50
- I TestRc (Match) Break

# If tiled top-right, then tile top

- I Current (State 5, State 9) Maximize False
- I State 9 False
- I State 8 True
- I Current (State 8) ResizeMoveMaximize 100 50 0 0
- I TestRc (Match) Break

# If tiled bottom-right, then tile bottom

- I Current (State 5, State 3) Maximize False
- I State 3 False
- I State 2 True
- I Current (State 2) ResizeMoveMaximize 100 50 0 50
- I TestRc (Match) Break

Key Left A 4 TileLeft

DestroyFunc TileRight

AddToFunc TileRight

# if tiled and tiled right (up, middle or down) then do nothing

- I Current (State 5, State 3) Break
- I Current (State 5, State 6) Break
- I Current (State 5, State 9) Break

# If not tiled, tile right, give tiled state and tiled right state

- I Current (!State 5, !Maximized) ResizeMoveMaximize 50 100 50 0
- I Current (!State 5) State 6
- I Current (!State 5) State 5
- I TestRc (Match) Break

# If tiled left, then untile and remove tiled states

- I Current (State 5, State 4) Maximize False
- I State 4 False
- I State 5 False
- I TestRc (Match) Break

# If tiled top, then tile top-right

- I Current (State 5, State 8) Maximize False
- I State 8 False
- I State 9 True
- I Current (State 9) ResizeMoveMaximize 50 50 50 0
- I TestRc (Match) Break

# If tiled bottom, then tile bottom-right

- I Current (State 5, State 2) Maximize False
- I State 2 False
- I State 3 True
- I Current (State 3) ResizeMoveMaximize 50 50 50 50
- I TestRc (Match) Break

# If tiled top-left, then tile top

- I Current (State 5, State 7) Maximize False
- I State 7 False
- I State 8 True
- I Current (State 8) ResizeMoveMaximize 100 50 0 0
- I TestRc (Match) Break

# If tiled bottom-left, then tile bottom

- I Current (State 5, State 1) Maximize False
- I State 1 False
- I State 2 True
- I Current (State 2) ResizeMoveMaximize 100 50 0 50
- I TestRc (Match) Break

Key Right A 4 TileRight

DestroyFunc TileUp

AddToFunc TileUp

# if tiled and tiled up (left, middle or right) then do nothing

- I Current (State 5, State 7) Break
- I Current (State 5, State 8) Break
- I Current (State 5, State 9) Break

# If not tiled, tile up, give tiled state and tiled up state

- I Current (!State 5, !Maximized) ResizeMoveMaximize 100 50 0 0
- I Current (!State 5) State 8
- I Current (!State 5) State 5
- I TestRc (Match) Break

# If tiled down, then untile and remove tiled states

- I Current (State 5, State 2) Maximize False
- I State 2 False
- I State 5 False
- I TestRc (Match) Break

# If tiled right, then tile top-right

- I Current (State 5, State 6) Maximize False
- I State 6 False
- I State 9 True
- I Current (State 9) ResizeMoveMaximize 50 50 50 0
- I TestRc (Match) Break

# If tiled left, then tile top-left

- I Current (State 5, State 4) Maximize False
- I State 4 False
- I State 7 True
- I Current (State 7) ResizeMoveMaximize 50 50 0 0
- I TestRc (Match) Break

# If tiled bottom-right, then tile right

- I Current (State 5, State 3) Maximize False
- I State 3 False
- I State 6 True
- I Current (State 6) ResizeMoveMaximize 50 100 50 0
- I TestRc (Match) Break

# If tiled bottom-left, then tile left

- I Current (State 5, State 1) Maximize False
- I State 1 False
- I State 4 True
- I Current (State 4) ResizeMoveMaximize 50 100 0 0
- I TestRc (Match) Break

Key Up A 4 TileUp

DestroyFunc TileDown

AddToFunc TileDown

# if tiled and tiled down (left, middle or right) then do nothing

- I Current (State 5, State 1) Break
- I Current (State 5, State 2) Break
- I Current (State 5, State 3) Break

# If not tiled, tile down, give tiled state and tiled down state

- I Current (!State 5, !Maximized) ResizeMoveMaximize 100 50 0 50
- I Current (!State 5) State 2
- I Current (!State 5) State 5
- I TestRc (Match) Break

# If tiled up, then untile and remove tiled states

- I Current (State 5, State 8) Maximize False
- I State 8 False
- I State 5 False
- I TestRc (Match) Break

# If tiled right, then tile bottom-right

- I Current (State 5, State 6) Maximize False
- I State 6 False
- I State 3 True
- I Current (State 3) ResizeMoveMaximize 50 50 50 50
- I TestRc (Match) Break

# If tiled left, then tile bottom-left

- I Current (State 5, State 4) Maximize False
- I State 4 False
- I State 1 True
- I Current (State 1) ResizeMoveMaximize 50 50 0 50
- I TestRc (Match) Break

# If tiled top-right, then tile right

- I Current (State 5, State 9) Maximize False
- I State 9 False
- I State 6 True
- I Current (State 6) ResizeMoveMaximize 50 100 50 0
- I TestRc (Match) Break

# If tiled top-left, then tile left

- I Current (State 5, State 7) Maximize False
- I State 7 False
- I State 4 True
- I Current (State 4) ResizeMoveMaximize 50 100 0 0
- I TestRc (Match) Break

Key Down A 4 TileDown

[/code]

Any help is much appreciated. Thanks.