Jump to content
evanfuchs

Center Alfred Window Without Dragging

Recommended Posts

I like for Alfred to remember its dragged position, but I'd like to re-center the window without having to drag it with the mouse.

 

Is it possible to manipulate Alfred's window position by keyboard, a workflow, script, etc? My goal would be to trigger Alfred, then if the window is off in a corner, hit a hotkey/keyword/shortcut to center the window and ideally leave it open for next command.

 

Thanks

Share this post


Link to post
Posted (edited)

Does anyone know if it's possible to change position Alfred's window position programmatically?

Edited by evanfuchs

Share this post


Link to post
22 hours ago, deanishe said:

You can manipulate most apps' windows programmatically.

 

Maybe I asked the question wrong, but I am looking for assistance specifically in repositioning Alfred's window without having to drag it. Would appreciate any suggestions.

Share this post


Link to post
Posted (edited)
1 hour ago, evanfuchs said:

I am looking for assistance specifically in repositioning Alfred's window without having to drag it

 

That much is clear. But you can’t just reposition a window: you have to move it to somewhere.

 

Lacking necessary information, I can only give you a demonstration: an AppleScript that moves Alfred's window 10 pixels upwards and 10 pixels to the left.

 

I'm sure you can adapt it to your actual requirements.

 

tell application "System Events" to tell application process "Alfred"
    if (count of windows) = 0 then
        -- ensure Alfred's window is open
        tell application id "com.runningwithcrayons.Alfred" to search ""
    end if
    set _pos to position of window 1
    set _x to item 1 of _pos
    set _y to item 2 of _pos
    set position of window 1 to {_x - 10, _y - 10}
end tell

 

Edited by deanishe

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...