{"id":14976944,"url":"https://github.com/github30/win11toast","last_synced_at":"2025-04-04T09:07:01.065Z","repository":{"id":54354194,"uuid":"522225175","full_name":"GitHub30/win11toast","owner":"GitHub30","description":"Toast notifications for Windows 10 and 11 based on WinRT","archived":false,"fork":false,"pushed_at":"2024-06-08T08:08:38.000Z","size":83,"stargazers_count":274,"open_issues_count":23,"forks_count":18,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-04T09:06:57.289Z","etag":null,"topics":["notifications","python","toast","windows","windows-runtime","windows11","winrt"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/win11toast/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GitHub30.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-07T13:47:28.000Z","updated_at":"2025-03-27T06:44:47.000Z","dependencies_parsed_at":"2024-06-19T17:09:50.497Z","dependency_job_id":"dff8ea83-5e51-4938-b265-cc76dd14175a","html_url":"https://github.com/GitHub30/win11toast","commit_stats":{"total_commits":82,"total_committers":2,"mean_commits":41.0,"dds":"0.012195121951219523","last_synced_commit":"e21e60933573c3a37bc2d6aa904e714d9c56aeba"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GitHub30%2Fwin11toast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GitHub30%2Fwin11toast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GitHub30%2Fwin11toast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GitHub30%2Fwin11toast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GitHub30","download_url":"https://codeload.github.com/GitHub30/win11toast/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149500,"owners_count":20891954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["notifications","python","toast","windows","windows-runtime","windows11","winrt"],"created_at":"2024-09-24T13:54:43.165Z","updated_at":"2025-04-04T09:07:01.046Z","avatar_url":"https://github.com/GitHub30.png","language":"Python","readme":"[![Python](https://img.shields.io/pypi/pyversions/win11toast.svg)](https://badge.fury.io/py/win11toast)\n[![PyPI](https://badge.fury.io/py/win11toast.svg)](https://badge.fury.io/py/win11toast)\n\n# win11toast\nToast notifications for Windows 10 and 11 based on [WinRT](https://docs.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts)\n\n![image](https://user-images.githubusercontent.com/12811398/183295421-59686d68-bfb2-4d9d-ad61-afc8bd4e4808.png)\n\n## Installation\n\n```bash\npip install win11toast\n```\n\n## Usage\n\n```python\nfrom win11toast import toast\n\ntoast('Hello Python🐍')\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183365362-dd163b1d-d01f-4b0e-9592-44bf63c6b4c2.png)\n\nhttps://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-text\n\n### Body\n\n```python\nfrom win11toast import toast\n\ntoast('Hello Python', 'Click to open url', on_click='https://www.python.org')\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183651326-286e1ce2-b826-41d7-8829-c46d5b64fb37.png)\n\n### Wrap text\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Earum accusantium porro numquam aspernatur voluptates cum, odio in, animi nihil cupiditate molestias laborum. Consequatur exercitationem modi vitae. In voluptates quia obcaecati!')\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183363789-e5a9c2bb-adf8-438d-9ebb-1e7693971a16.png)\n\n### Run Python script on Click\n```python\nfrom win11toast import toast\n\ntoast('Hello Pythonista', 'Click to run python script', on_click=r'C:\\Users\\Admin\\Downloads\\handler.pyw')\n# {'arguments': 'C:\\\\Users\\\\Admin\\\\Downloads\\\\handler.pyw', 'user_input': {}}\n```\n\nSince the current directory when executing the script is `C:\\Windows\\system32`, use `os.chdir()` accordingly.\n\ne.g. [handler.pyw](https://gist.github.com/GitHub30/dae1b257c93d8315ea38554c9554a2ad)\n\nOn Windows, you can run a Python script in the background using the pythonw.exe executable, which will run your program with no visible process or way to interact with it.\n\nhttps://stackoverflow.com/questions/9705982/pythonw-exe-or-python-exe\n\n![2b53d4528ff94d40a0ab6da7c7fe33c6](https://user-images.githubusercontent.com/12811398/196034007-053ffe1c-4a95-441b-af06-ffc3753a1c64.gif)\n\n### Callback\n\n```python\nfrom win11toast import toast\n\ntoast('Hello Python', 'Click to open url', on_click=lambda args: print('clicked!', args))\n# clicked! {'arguments': 'http:', 'user_input': {}}\n```\n\n### Icon\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Hello from Python', icon='https://unsplash.it/64?image=669')\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183359855-aa0a8d39-8249-4055-82cb-5968ab35e125.png)\n\n#### Square\n\n```python\nfrom win11toast import toast\n\nicon = {\n    'src': 'https://unsplash.it/64?image=669',\n    'placement': 'appLogoOverride'\n}\n\ntoast('Hello', 'Hello from Python', icon=icon)\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183659504-e83d1110-8f38-4f8e-81d6-b99ef9c4537c.png)\n\n### Image\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Hello from Python', image='https://4.bp.blogspot.com/-u-uyq3FEqeY/UkJLl773BHI/AAAAAAAAYPQ/7bY05EeF1oI/s800/cooking_toaster.png')\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183360063-36caef94-bb3e-4eef-ac15-d5d6c86e5d40.png)\n\nhttps://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-image\n\n#### Hero\n\n```python\nfrom win11toast import toast\n\nimage = {\n    'src': 'https://4.bp.blogspot.com/-u-uyq3FEqeY/UkJLl773BHI/AAAAAAAAYPQ/7bY05EeF1oI/s800/cooking_toaster.png',\n    'placement': 'hero'\n}\n\ntoast('Hello', 'Hello from Python', image=image)\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183660596-8bff003e-af94-4554-b188-5946e9981723.png)\n\n### Progress\n\n```python\nfrom time import sleep\nfrom win11toast import notify, update_progress\n\nnotify(progress={\n    'title': 'YouTube',\n    'status': 'Downloading...',\n    'value': '0',\n    'valueStringOverride': '0/15 videos'\n})\n\nfor i in range(1, 15+1):\n    sleep(1)\n    update_progress({'value': i/15, 'valueStringOverride': f'{i}/15 videos'})\n\nupdate_progress({'status': 'Completed!'})\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183574436-05e3b504-bdec-46b1-a3f5-1ef861bb856a.png)\n\nAttributes\nhttps://docs.microsoft.com/en-ca/uwp/schemas/tiles/toastschema/element-progress\n\nhttps://docs.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/toast-progress-bar\n\n### Audio\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Hello from Python', audio='ms-winsoundevent:Notification.Looping.Alarm')\n```\n\nAvailable audio\nhttps://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-audio\n\n##### From URL\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Hello from Python', audio='https://nyanpass.com/nyanpass.mp3')\n```\n\n##### From file\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Hello from Python', audio=r\"C:\\Users\\Admin\\Downloads\\nyanpass.mp3\")\n```\n\nI don't know how to add custom audio please help.\n\nhttps://docs.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/custom-audio-on-toasts\n\n#### Loop\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Hello from Python', audio={'loop': 'true'})\n```\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Hello from Python', audio={'src': 'ms-winsoundevent:Notification.Looping.Alarm', 'loop': 'true'})\n```\n\n### Silent🤫\n\n```python\nfrom win11toast import toast\n\ntoast('Hello Python🐍', audio={'silent': 'true'})\n```\n\n### Speak🗣\n\n```python\nfrom win11toast import toast\n\ntoast('Hello Python🐍', dialogue='Hello world')\n```\n\n### OCR👀\n\n```python\nfrom win11toast import toast\n\ntoast(ocr='https://i.imgur.com/oYojrJW.png')\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183774255-3b78723a-a1ea-4b67-8342-5edfbb329c24.png)\n\n```python\nfrom win11toast import toast\n\ntoast(ocr={'lang': 'ja', 'ocr': r'C:\\Users\\Admin\\Downloads\\hello.png'})\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183774317-e1bc2454-3649-4573-9212-5f18d221c162.png)\n\n### Long duration\n\n```python\nfrom win11toast import toast\n\ntoast('Hello Python🐍', duration='long')\n```\n\ndisplayed for 25 seconds\nhttps://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-toast\n\n### No timeout\n\n```python\nfrom win11toast import toast\n\ntoast('Hello Python🐍', scenario='incomingCall')\n```\n\nThe scenario your toast is used for, like an alarm, reminder, incomingCall or urgent.\n\nhttps://learn.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-toast#:~:text=None-,scenario,-The%20scenario%20your\n\n![image](https://github.com/GitHub30/win11toast/assets/12811398/f7e65d41-7bd6-4e64-82ff-2ed7eab82922)\n\n\n### Button\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Hello from Python', button='Dismiss')\n# {'arguments': 'http:Dismiss', 'user_input': {}}\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183361855-1269d017-5354-41db-9613-20ad2f22447a.png)\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Hello from Python', button={'activationType': 'protocol', 'arguments': 'https://google.com', 'content': 'Open Google'})\n# {'arguments': 'https://google.com', 'user_input': {}}\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183655824-ee2b9001-3808-45fd-b264-8c83b07aa4a2.png)\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Click a button', buttons=['Approve', 'Dismiss', 'Other'])\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183363035-af9e13cc-9bb1-4e25-90b3-9f6c1c00b3dd.png)\n\nhttps://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-action\n\n#### Play music or Open Explorer\n\n```python\nfrom win11toast import toast\n\nbuttons = [\n    {'activationType': 'protocol', 'arguments': 'C:\\Windows\\Media\\Alarm01.wav', 'content': 'Play'},\n    {'activationType': 'protocol', 'arguments': 'file:///C:/Windows/Media', 'content': 'Open Folder'}\n]\n\ntoast('Music Player', 'Download Finished', buttons=buttons)\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183657915-1068c0d9-fc1a-4f6d-82c2-7835c3d9e585.png)\n\n### Input\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Type anything', input='reply', button='Send')\n# {'arguments': 'http:Send', 'user_input': {'reply': 'Hi there'}}\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183361532-b554b9ae-e426-4fb1-8080-cc7c52d499d7.png)\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Type anything', input='reply', button={'activationType': 'protocol', 'arguments': 'http:', 'content': 'Send', 'hint-inputId': 'reply'})\n# {'arguments': 'http:', 'user_input': {'reply': 'Hi there'}}\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183655443-340593e3-41ec-40b5-96a9-d7ba69fd10a2.png)\n\nhttps://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-input\n\n### Selection\n\n```python\nfrom win11toast import toast\n\ntoast('Hello', 'Which do you like?', selection=['Apple', 'Banana', 'Grape'], button='Submit')\n# {'arguments': 'dismiss', 'user_input': {'selection': 'Grape'}}\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183361008-4cdd9445-683c-432e-8094-1c2193e959db.png)\n\n![image](https://user-images.githubusercontent.com/12811398/183361138-2b81e8aa-bcbf-4764-a396-b7787518904b.png)\n\n### No arguments\n\n```python\nfrom win11toast import toast\n\ntoast()\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183362441-8d865a74-f930-4c16-9757-22244d22a8e2.png)\n\n### Non blocking\n\n```python\nfrom win11toast import notify\n\nnotify('Hello Python', 'Click to open url', on_click='https://www.python.org')\n```\n\n### Async\n\n```python\nfrom win11toast import toast_async\n\nasync def main():\n    await toast_async('Hello Python', 'Click to open url', on_click='https://www.python.org')\n```\n\n### Jupyter\n\n```python\nfrom win11toast import notify\n\nnotify('Hello Python', 'Click to open url', on_click='https://www.python.org')\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183650662-3a3f56f6-4a20-48f1-8649-155948aa21e0.png)\n\n```python\nfrom win11toast import toast_async\n\nawait toast_async('Hello Python', 'Click to open url', on_click='https://www.python.org')\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183295534-82b0a6d1-8fa6-4ddc-bfb0-5021158b3cb0.png)\n\n```python\nimport urllib.request\nfrom pathlib import Path\nsrc = str(Path(urllib.request.urlretrieve(\"https://i.imgur.com/p9dRdtP.jpg\")[0]).absolute())\n\nfrom win11toast import toast_async\nawait toast_async('にゃんぱすー', audio='https://nyanpass.com/nyanpass.mp3', image={'src': src, 'placement':'hero'})\n```\n\n```python\nfrom win11toast import toast_async\n\nawait toast_async('Hello Python🐍', dialogue='にゃんぱすー')\n```\n\n## Debug\n\n```python\nfrom win11toast import toast\n\nxml = \"\"\"\n\u003ctoast launch=\"action=openThread\u0026amp;threadId=92187\"\u003e\n\n    \u003cvisual\u003e\n        \u003cbinding template=\"ToastGeneric\"\u003e\n            \u003ctext hint-maxLines=\"1\"\u003eJill Bender\u003c/text\u003e\n            \u003ctext\u003eCheck out where we camped last weekend! It was incredible, wish you could have come on the backpacking trip!\u003c/text\u003e\n            \u003cimage placement=\"appLogoOverride\" hint-crop=\"circle\" src=\"https://unsplash.it/64?image=1027\"/\u003e\n            \u003cimage placement=\"hero\" src=\"https://unsplash.it/360/180?image=1043\"/\u003e\n        \u003c/binding\u003e\n    \u003c/visual\u003e\n\n    \u003cactions\u003e\n\n        \u003cinput id=\"textBox\" type=\"text\" placeHolderContent=\"reply\"/\u003e\n\n        \u003caction\n          content=\"Send\"\n          imageUri=\"Assets/Icons/send.png\"\n          hint-inputId=\"textBox\"\n          activationType=\"background\"\n          arguments=\"action=reply\u0026amp;threadId=92187\"/\u003e\n\n    \u003c/actions\u003e\n\n\u003c/toast\u003e\"\"\"\n\ntoast(xml=xml)\n```\n\n![image](https://user-images.githubusercontent.com/12811398/183369144-5007e122-2325-49b3-97d8-100906cd6e56.png)\n\n\n[Notifications Visualizer](https://www.microsoft.com/store/apps/notifications-visualizer/9nblggh5xsl1)\n![image](https://user-images.githubusercontent.com/12811398/183335533-33562c5c-d467-4acf-92a4-5e8f6ef05e1f.png)\n\n\n# Acknowledgements\n\n- [winsdk_toast](https://github.com/Mo-Dabao/winsdk_toast)\n- [Windows-Toasts](https://github.com/DatGuy1/Windows-Toasts)\n- [MarcAlx/notification.py](https://gist.github.com/MarcAlx/443358d5e7167864679ffa1b7d51cd06)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub30%2Fwin11toast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub30%2Fwin11toast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub30%2Fwin11toast/lists"}