KISS 🇺🇦

Stop the war!

Stop the war in Ukraine! Fuck putin!

More information is at: https://war.ukraine.ua/.

There is a fund to support the Ukrainian Army: https://savelife.in.ua/en/donate/, and there is a special bank account that accepts funds in multiple currencies: https://bank.gov.ua/en/about/support-the-armed-forces. I donated to them. Please donate if you can!

Killer putin

Killer putin. Source: politico.eu.

Arrested putin

"It hasn't happened yet, but it will happen sooner or later. Beautiful photo, isn't it?" Source: twitter.

OSX: Close notification with keyboard

| comments

OS X’s UI looks nice, but isn’t very keyboard-friendly. For example, there is no standard shortcut to expand or minimize a window (yes, Cmd+M typically works, but it depends on the Window > Minimize menu command, which is sometimes not present). The same is true for the notification center, specifically calendar invitations/reminders that display a notification popup by default with two buttons: Close and Accept/Remind later. How do you dismiss it with the keyboard alone?

Luckily someone already came up with an AppleScript (another invention from apple) to click the first button on the notification. The source is on StackExchange; I’m reposting it here:

(close_notif.scpt) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
my closeNotif()
on closeNotif()

    tell application "System Events"
        tell process "NotificationCenter"
            set theWindows to every window
            repeat with i from 1 to number of items in theWindows
                set this_item to item i of theWindows
                try
                    click button 1 of this_item
                on error
                    my closeNotif()
                end try
            end repeat
        end tell
    end tell

end closeNotif

You can open this script in the Script Editor.app, select File > Export…, set “File Format:” to “Application”, save to e.g. ~/bin/. I use Alfred and don’t know if it’s the default or not, but after saving the “application”, it’s immediately available in Alfred. It’s very quick to open its window and type clo, in my case the first search result is the application.

One more note: on first launch, it’ll ask for accessibility to access other processes. You’ll need to go to System Preferences > Security & Privacy > Privacy > Accessibility, possibly unlock it with your password, and enable accessibility for close_notif.app.

It works well. Nevertheless, it is annoying that there is no standard way to do that in the system.

Comments