← Kleave

Build the shortcut yourself

Kleave moves windows through one small shortcut in the Shortcuts app. If you'd rather not add the ready-made file, you can build the same shortcut by hand. The video goes through every step.

Keep Kleave's setup window open while you build it, and type the name Kleave Window Mover last, once every action is in: Kleave picks the shortcut up the moment the name matches.

Step by step

The same steps as the video, with a picture of each. Copy the values rather than typing them: Kleave reads the keys, the replies and the name character for character.

  1. 1Start in Kleave

    In Kleave's setup window, click Add Shortcut…. When Shortcuts shows the shortcut, click Don't Add. Leave Kleave's window open: it now watches for the shortcut you build.

  2. 2Make a new shortcut

    In Shortcuts, click +. Leave the name alone for now — you set it last.

  3. 3Read the input

    Search the action list for Get Dictionary from Input and drag it in. Set it to read Shortcut Input.

  4. 4Accept text

    At the top of the shortcut, set the input type to Text. Kleave sends each request as a short piece of text.

  5. 5Read the request

    Add Get Dictionary Value. Set it to get the Value for the key op.

    • op
  6. 6Check for a ping

    Add If and set it to: Dictionary Value is ping. Shortcuts adds Otherwise and End If on its own.

    • ping
  7. 7Answer the ping

    Inside the If, add Text containing exactly {"v":1}, then Stop and Output with that Text. Kleave pings the shortcut to check it is there.

    • {"v":1}
  8. 8Find the window

    Under Otherwise, add Find Windows with five filters: App, X, Y, Width and Height. For each value, insert the Dictionary variable, click it, choose Get Value for Key and type the key: app, mx, my, mw, mh.

    • app
    • mx
    • my
    • mw
    • mh
  9. 9Keep the front window

    In the same Find Windows, set Sort by to Window Index and check that Order is Smallest First. Turn Limit on and set Get to 1. Two windows of one app can share a spot; this keeps only the frontmost, the one Kleave means.

    • 1
  10. 10Catch a missing window

    Below Find Windows, add another If: Windows count is 0.

    • 0
  11. 11Report it

    Inside that If, add Text with {"v":1,"ok":false,"reason":"notFound"}, then Stop and Output.

    • {"v":1,"ok":false,"reason":"notFound"}
  12. 12Resize the window

    Under its Otherwise, add Resize Window for Windows, with the keys w and h. Open its options and turn Bring to Front off.

    • w
    • h
  13. 13Move it

    Add Move Window for Windows, to the keys x and y. Turn Bring to Front off here too.

    • x
    • y
  14. 14Resize once more

    Add a second Resize Window with w and h, Bring to Front off. The order is on purpose: apps limit each change by the window's current size and position.

    • w
    • h
  15. 15Report success

    Finish with Text containing {"v":1,"ok":true}, then Stop and Output.

    • {"v":1,"ok":true}
  16. 16Name it, last

    Click the title and type Kleave Window Mover, with the same capitals and spaces. Kleave takes the shortcut the moment the name matches, so name it only once every action is in.

    • Kleave Window Mover
  17. 17Back to Kleave

    Switch to Kleave. It finds your shortcut, checks it, and tells you it's ready. That's it.