Clicky

Hwee-Boon Yar

Hi, I'm Hwee-Boon Yar

I write, ship and sell software products. iOS/OS X app developer based in Singapore, working remotely. This is my blog.

.

Need to run a code review on your codebase? Hire me

Notes on Configuring a Keyboard Shortcut to Close Notifications on Big Sur with Phoenix

This is about configuring a keyboard shortcut (F12) to close notifications on Big Sur with Phoenix.

Key.on('f12', [], function () {
  Task.run('/usr/local/bin/cliclick', ['m:1200,100'], null)
  Task.run('/usr/bin/osascript',
    ['-e', 'tell application "System Events"\n' +
      'tell process "NotificationCenter"\n' +
      'set this_item to window 1\n' +
      'click button 1 of group 1 of UI element 1 of scroll area of this_item\n' +
      'end tell\n' +
      'end tell\n' +
      'return\n'], null)
})

2 things:

  1. This requires cliclick to be installed with brew install cliclick. Phoenix can probably control the cursor, but I ran out of time.
  2. You need to adjust the coordinators (1200,100 above) so it moves your cursor to be over the notification

Like this post? Follow me on Twitter.

.