Jump to content

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

Link to comment
  • 2 weeks later...
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.

Link to comment
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
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...