Skip to content

Instantly share code, notes, and snippets.

@jenikm
Last active November 14, 2020 04:58
Show Gist options
  • Save jenikm/999eacaf62353e53ec13e5dcc3396f6e to your computer and use it in GitHub Desktop.
Save jenikm/999eacaf62353e53ec13e5dcc3396f6e to your computer and use it in GitHub Desktop.
Dismiss notifications - MacOS: Big Sur
#!/usr/bin/env osascript
tell application "System Events"
tell process "NotificationCenter"
tell window 1
tell scroll area 1
tell UI element 1
tell group 1
if exists then
set current_mouse_xy to (do shell script "/usr/local/bin/cliclick p")
set dialog_xy to position
set dialog_x to (item 1 of dialog_xy)
set dialog_y to (item 2 of dialog_xy)
do shell script "/usr/local/bin/cliclick m:$((" & dialog_x & "+50)),$((" & dialog_y & "+25))"
try
click button "Close"
end try
try
click button "Clear All"
end try
do shell script "/usr/local/bin/cliclick m:" & current_mouse_xy
end if
end tell
end tell
end tell
end tell
end tell
end tell
@jenikm
Copy link
Author

jenikm commented Nov 14, 2020

Depends on: brew install cliclick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment