Created
October 8, 2024 17:46
-
-
Save edersonbadeca/7fa093ee271fd902dd3ee43479ce5b4d to your computer and use it in GitHub Desktop.
adjust-notification-center-position.scpt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
tell application process "NotificationCenter" | |
repeat while true | |
if exists window "Notification Center" then | |
try | |
repeat with theWindow in (get windows whose name is "Notification Center") | |
set displaySize to size of theWindow | |
set notifSize to size of UI element 1 of scroll area 1 of group 1 of theWindow | |
set currentPos to position of theWindow | |
set newPos to {-((first item of displaySize) - (first item of notifSize)) / 2, ((second item of displaySize) - (second item of notifSize) - 56)} | |
if currentPos ≠ newPos then | |
set position of theWindow to newPos | |
end if | |
end repeat | |
on error errMsg | |
log "Erro ao ajustar a janela: " & errMsg | |
end try | |
end if | |
delay 0.5 | |
end repeat | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment