├── Capture.PNG ├── Capture2.PNG ├── LICENSE ├── README.md ├── heart.ico └── notifier.py /Capture.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s-shemmee/Desktop-Notifier-Python/367a36581909f005dbce536949c76ab6196a2580/Capture.PNG -------------------------------------------------------------------------------- /Capture2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s-shemmee/Desktop-Notifier-Python/367a36581909f005dbce536949c76ab6196a2580/Capture2.PNG -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 s-shemmee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Desktop Notifier App in Python 2 | 3 | A desktop notifier is a simple Python application that displays a desktop pop-up message as a notification. The user receives a notification whenever a particular app is launched. 4 | 5 | ## How we can use it? 6 | 7 | - Daily reminder to take your medication. 8 | - Ask a question 9 | - Hourly reminder to drink water. 10 | - Notify about updates 11 | - Birthday reminder 12 | - Gym reminder 13 | - Promote a limited-time deal 14 | - Collect feedback 15 | - Daily tracker for COVID stats in your country 16 | 17 | and many more, it’s completely up to you how to use this application. 18 | 19 | ## What we need ? 20 | 21 | ### Plyer 22 | 23 | *Plyer is an open source library to access features commonly found in various platforms via python.* 24 | 25 | ## Installing required python packages 26 | 27 | *we need to download two important packages for this application.* 28 | 29 | *Open your terminal and run the following command.* 30 | 31 | - **1.requests** : 32 | 33 | in case you want to fetch data from the web 34 | 35 | ```terminal 36 | pip install requests 37 | ``` 38 | 39 | - **2. plyer** : 40 | 41 | For creating notifications on your PC 42 | 43 | ```terminal 44 | pip install plyer 45 | ``` 46 | 47 | *Now that we have the packages, we are ready to import it in our python script.* 48 | 49 | ```py 50 | from plyer import notification 51 | ``` 52 | 53 | ## Coding Timuu 54 | 55 | - Now let's specify the parameters. 56 | 57 | ```py 58 | from plyer import notification 59 | 60 | title = 'Hi, Hello and Hi !' 61 | 62 | message= 'If u reading this ~I LOVE U TO THE MOON AND BACK !!' 63 | 64 | notification.notify(title= title, 65 | message= message, 66 | app_icon = "heart.ico", 67 | timeout= 15, 68 | toast= False) 69 | 70 | time.sleep(60*60) 71 | ``` 72 | 73 | - Let's look at what the parameters mean: 74 | 75 | ```markdown 76 | Syntax: notify(title=”, message=”, app_name=”, app_icon=”, timeout=10, ticker=”, toast=False) 77 | ``` 78 | 79 | Parameters: 80 | 81 | - `title (str`) : Title of the notification 82 | - `message (str)` : Message of the notification 83 | - `app_name (str)` : Name of the app launching this notification 84 | - `app_icon (str)` : Icon to be displayed along with the message 85 | - `timeout (int)` : time to display the message for, defaults to 10 86 | - `time.sleep` : After displaying a notification, we will make it sleep for 1 hour or 60 minutes. You can choose a different interval. 87 | - `ticker (str)` : text to display on status bar as the notification arrives 88 | - `toast (bool)` : simple Android message instead of full notification 89 | 90 | ## Here is how you see your notification after running your application 91 | 92 | ![notification after running](Capture.PNG) 93 | 94 | ## How to make a python application to run in the background? 95 | 96 | *Just follow this simple command to make your application run in the background, note you need to type this command in command prompt in case you are using Windows and terminal in case you are using Linux.* 97 | 98 | > Note: replace the `` with your file name 99 | 100 | ```terminal 101 | pythonw.exe .\ 102 | example 103 | pythonw.exe .\notifier.py 104 | ``` 105 | 106 | *That's it your application now starts running in the background.* 107 | 108 | ## How do you confirm that your application is running in the background? 109 | 110 | *open task manager in your pc and you can see that in background process you can see python is running.* 111 | 112 | ![script running in the backgroung](Capture2.PNG) 113 | 114 | ## How to stop getting notifications? 115 | 116 | *That’s simple, in the task manager kill the process named python. If you feel any difficulty in stoping the notification please feel free to post your difficulty in the Discussion section of this Documentation.* -------------------------------------------------------------------------------- /heart.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s-shemmee/Desktop-Notifier-Python/367a36581909f005dbce536949c76ab6196a2580/heart.ico -------------------------------------------------------------------------------- /notifier.py: -------------------------------------------------------------------------------- 1 | from plyer import notification 2 | import time 3 | 4 | title = 'Hi, Hello and Hi !' 5 | 6 | message = 'If u reading this ~I LOVE U TO THE MOON AND BACK !!' 7 | 8 | notification.notify(title = title, 9 | message = message, 10 | #creating icon for the notification 11 | app_icon = "heart.ico", 12 | #the notification stays for 15sec 13 | timeout = 15, 14 | toast = False) 15 | 16 | #sleep for 1 hr => 60*60 sec 17 | #notification repeats after every 1 hr 18 | time.sleep(60*60) 19 | --------------------------------------------------------------------------------