Code Monkey home page Code Monkey logo

macos-notifications's Introduction

macos-notifications

Mac supported Package version Supported Python versions


Documentation: https://jorricks.github.io/macos-notifications/

Source Code: https://github.com/Jorricks/macos-notifications


mac-notification is a Python library to make it as easy as possible to create interactable notifications.

Installation

To use macos-notifications, first install it using pip:

pip install macos-notifications

Features

  • ๐Ÿš€ Easy python interface. It's as simple as 'client.create_notification(title="Meeting starts now!", subtitle="Team Standup")'
  • ๐Ÿ’ฅ Ability to add action buttons with callbacks!
  • ๐Ÿ“ Ability to reply to notifications!
  • โŒš Delayed notifications.
  • โฑ๏ธ Automatically time out the notification listener.
  • ๐Ÿ“ฆ Just pyobjc as a dependency.

Example

from functools import partial
from mac_notifications import client

if __name__ == "__main__":
    client.create_notification(
        title="Meeting starts now!",
        subtitle="Team Standup",
        icon="/Users/jorrick/zoom.png",
        sound="Frog",
        action_button_str="Join zoom meeting",
        action_callback=partial(join_zoom_meeting, conf_number=zoom_conf_number)
    )

A simple example. Please look in the docs for more examples like this:

macos-notifications

Why did you create this library?

I wanted a library that did not depend on any non-python tools (so you had to go around and install that). Instead, I wanted a library where you install the pip packages, and you are done. Later I realised how hard it was to integrate correctly with PyOBJC. Also, I had a hard time finding any examples on how to easily integrate this in a non-blocking fashion with my tool. Hence, I figured I should set it up to be as user-friendly as possible and share it with the world ;)!

Limitations

Although there are some limitations, there is no reason to not use it now โœŒ๏ธ.

  • You need to keep your application running while waiting for the callback to happen.
  • We do not support raising notifications from anything but the main thread. If you wish to raise it from other threads, you need to set up a communication channel with the main thread, which in turn than raises the notification.
  • Currently, we are only supporting the old deprecated user notifications. If you wish to use the new implementation, please feel free to propose an MR.
  • You can not change the main image of the notification to be project specific. You can only change the Python interpreter image, but that would impact all notifications send by Python.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.