How to Clear All “Disk Not Ejected Properly” Notifications Automatically
In our digital age, it’s not uncommon to come across the pesky “Disk Not Ejected Properly” notification on your computer, particularly if you’re using macOS. These notifications can clutter your screen, especially if they pop up every time you disconnect a drive without following the ejection protocol. Clearing them manually gets old fast. Fortunately, with a little bit of automation, you can clear these notifications automatically.
The solution involves using Automator, a built-in application on macOS, combined with a simple shell script. Here’s how to set it up:
1.Open Automator: You’ll find this application in your Applications folder or you can search for it using Spotlight.
2.Create a New Document: Once Automator is open, create a new document by selecting ‘New Document’ and then choose ‘Application’ as the type of your document.
3.Search for ‘Run Shell Script’: In the search bar on the left panel within Automator, type in “shell” and drag the ‘Run Shell Script’ action to the workflow on the right.
4.Write the Script to Clear Notifications:
In the shell script box that appears in your workflow, enter the following command:
“`shell
osascript -e ‘tell application “System Events” to click (every UI element whose description is “notification”) of (every group whose description is “notification group”) of process “NotificationCenter”‘
“`
This AppleScript clicks all notifications that are labeled as such in the Notification Center, effectively clearing them from view.
5.Save Your Application: Give your new application an appropriate name like ‘ClearNotifications’ and choose where to save it.
6.Execute the App When Needed: You can either run this application manually whenever you need to clear notifications by simply double-clicking on it or set up custom shortcuts or automation through System Preferences under ‘Keyboard’ > ‘Shortcuts’.
Remember that this approach uses AppleScript and Automator which are subject to change in future macOS updates, so it may require adjustments down the line. Additionally, always verify any scripts before running them to avoid unintended actions on your system.
By setting up this simple automation application, you’ll no longer be bothered by a barrage of “Disk Not Ejected Properly” notifications after disconnecting drives or storage media from your Mac.