evanfuchs Posted July 9, 2020 Share Posted July 9, 2020 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
evanfuchs Posted July 19, 2020 Author Share Posted July 19, 2020 (edited) Does anyone know if it's possible to change position Alfred's window position programmatically? Edited July 19, 2020 by evanfuchs Link to comment
deanishe Posted July 19, 2020 Share Posted July 19, 2020 You can manipulate most apps' windows programmatically. Link to comment
evanfuchs Posted July 20, 2020 Author Share Posted July 20, 2020 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
deanishe Posted July 20, 2020 Share Posted July 20, 2020 (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 July 20, 2020 by deanishe Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now