[PYTHON] Notify Notification Center

Basically, it doesn't do a lot of heavy work, but it takes a few seconds to build a LaTeX 4 page because the Mac is old.

I'm writing like this now.

--Type into a tex file with atom --Watched by watchdog module --The change has come !!, the invoke file will run. (I want to change it to fab soon) --I don't understand the makefile. (The grammar is unpleasant) --When you finish running, you will be notified to the notification center. Like "LaTeX Build Finish !!"

This article is about using Notification Center while slack is in vogue.

setup

Let's put the module

$ pip install pync

Write the source

#! python
from pync import Notifier

def mac_notify(msg=""):
    try:
        Notifier.notify("Task Finish. %s " % msg, title="Invoke Task")
    except:
        Notifier.notify("Task Finish.", title="Invoke Task")

if __name__ == "__main__":
   mac_notify("test")

Conclusion

This module is for MacOS, so you need to look for Linux separately.

But personally, Linux isn't often used on the desktop ...

Recommended Posts

Notify Notification Center
Notify using Notification Center when the execution environment is macOS in Python