Last active
August 25, 2023 20:06
-
-
Save htlin222/0dbed84f79b54717d2218de8b9b3fcf4 to your computer and use it in GitHub Desktop.
This code displays a notification with the message "Hello, world!" using the OS X notification system.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# title: pytest | |
# date: "2023-08-26" | |
# author: Hsieh-Ting Lin, the Lizard 🦎 | |
title = "Hellow" | |
body = "🦎" | |
def run_macos_notification(title, body): | |
command = ( | |
f'osascript -e \'display notification with title "{title}" subtitle "{body}"\'' | |
) | |
subprocess.run(command, shell=True) | |
run_macos_notification(title, body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment