Est’s Blog

Original link:

There is a paid timer at work. I want to play a reminder on the computer before the countdown ends, manually end the billing, and get down to the API. Next is how to pop up the window.

I originally wanted to use the UNUserNotificationCenter that comes with macOS to open a pop-up window through PyObjC, but encountered two problems:

  1. The PyObjC that comes with the system is too old. Or Python2.7. in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
  2. Only compatible with the old NSUserNotification , the status is macOS 10.8–11.0 Deprecated New API calls require process signature.

    codesign -dv --verbose=4 /usr/bin/python2.7

Only the official python2.7 signed anaconda/miniconda are not signed. never mind. Or go directly to AppleScript

 osascript -e 'display notification "还有1分钟到达时辰" with title "准时付费" sound name "Frog"'

I want to add a snooze 1 minute function to this prompt, but it doesn’t seem to support it. That’s it. 2333

This article is reproduced from:
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment