Code Monkey home page Code Monkey logo

notify-py's People

Contributors

dynobo avatar giorgosxou avatar jnoortheen avatar leterax avatar ms7m avatar transparentlc avatar wingdust avatar wisnij avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

notify-py's Issues

Installation problem: pip install notify-py or something else seems to be problematic

I typed pip install notify-py and ran the following code :

from notifypy import Notify

notification = Notify()
notification.title = "Cool Title"
notification.message = "Even cooler message."
notification.send()

My IDE (Pycharm) gave package error (cannot write exactly but something like this) "cannot find package notifypy"
I clicked install package option the IDE suggested, after that I got the error "Cannot find reference 'Notify' in 'init.py"

Notification Sound not working on Linux

I am using parrot os.
I have use the library for my project and everything works great except for the sound.
At first it used .mp3 and it threw an error so i changed to .wav file and now i am not having errors but still when the notification comes, there is no sound.

notification shown very slow

Hi, I tried this package on my windows 11 computer, I have python 3.11 and the latest notifypy 0.3.42 installed. I tried to show a simple notification by both cli and code. Both of them very slow, about half a minute until the notification shown. And in the later tests, it used about 16 seconds.

notifypy --title hello --message "nice to meet you" --applicationName "notifypy"
>>> from notifypy import Notify
>>>
>>> notification = Notify()
>>> notification.title = "Cool Title"
>>> notification.message = "Even cooler message."
>>> notification.send()
True
>>> import notifypy
>>> notifypy.__version__
'0.3.42'
>>>
>>> import time
>>> from notifypy import Notify
>>> notification = Notify()
>>> notification.title = "Cool Title"
>>> notification.message = "Even cooler message."
>>> start = time.perf_counter(); notification.send(); print(f"Elapsed {time.perf_counter() - start:.03f} seconds.")
True
Elapsed 41.283 seconds.
>>> # In the later test
>>> start = time.perf_counter(); notification.send(); print(f"Elapsed {time.perf_counter() - start:.03f} seconds.")
True
Elapsed 15.669 seconds.
>>> start = time.perf_counter(); notification.send(); print(f"Elapsed {time.perf_counter() - start:.03f} seconds.")
True
Elapsed 15.697 seconds.
>>> start = time.perf_counter(); notification.send(); print(f"Elapsed {time.perf_counter() - start:.03f} seconds.")
True
Elapsed 15.695 seconds.
>>> start = time.perf_counter(); notification.send(); print(f"Elapsed {time.perf_counter() - start:.03f} seconds.")
True
Elapsed 15.664 seconds.
>>>
>>> from timeit import timeit
>>> timeit("notification.send()", globals=globals(), number=2)
31.34698849997949
>>>

I also tried plyer.notification, it is very quickly, about one or two seconds only.

>>> from plyer import notification
>>> notification.notify("hello", "nice to meet you", "plyer")

Audio is not playing during notification

Hi:
I moved from Linux Mint 20.1 to 20.3 and now I noticed that the audio of the notification is not playing properly.
It is not a problem with the audio file (wav) or with the python script, because when I execute the python script it doesn't play, but if I execute it again in a short time it execute well with the audio as many times as I execute it.
My version is notify-py==0.3.42
The logging shows:
lixbeto2@lix:/Beto$ ./PurgarSSD.py
2023-10-10 19:35:46.893 | INFO | notifypy.notify:init:50 - Logging is enabled.
2023-10-10 19:35:46.897 | INFO | notifypy.os_notifiers.linux::16 - libnotify found, using it for notifications
2023-10-10 19:35:46.897 | DEBUG | notifypy.os_notifiers.linux:send_notification:74 - Generated command: ['/usr/bin/notify-send', 'Purgado de Disco Duro', 'Comienza el Purgado (shred) del Disco Duro', '--icon=/home/lix/Beto/Iconos/Archivos.png', "--app-name='Python Application (notify.py)'", '-u', 'normal']
2023-10-10 19:35:46.907 | INFO | notifypy.notify:send_notification:351 - Sent notification.
lixbeto2@lix:/Beto$ ./PurgarSSD.py
2023-10-10 19:35:47.879 | INFO | notifypy.notify:init:50 - Logging is enabled.
2023-10-10 19:35:47.882 | INFO | notifypy.os_notifiers.linux::16 - libnotify found, using it for notifications
2023-10-10 19:35:47.883 | DEBUG | notifypy.os_notifiers.linux:send_notification:74 - Generated command: ['/usr/bin/notify-send', 'Purgado de Disco Duro', 'Comienza el Purgado (shred) del Disco Duro', '--icon=/home/lix/Beto/Iconos/Archivos.png', "--app-name='Python Application (notify.py)'", '-u', 'normal']
2023-10-10 19:35:47.895 | INFO | notifypy.notify:send_notification:351 - Sent notification.

The first time it didn't play, but the second it played well.
Does it mean I have some kind of problem with libnotify app? It is 0.7.9 release.

Missing 0.3.3 tag

PyPi has version 0.3.3 but the latest tag here is 0.3.2. Is there any difference?

notification.audio does not work on windows 10

I have confirmed it just doesn't work on my computer. I tried different wav audio files and it neither gave me an error nor any sound that i hoped to hear. :(
image

#Windows Logon.wav = a file that I copied from "%windir%/media".
#Windows version = Microsoft Windows 10 Home, version 10.0.19045 N/A Build 19045

Custom icons are not showing on Linux

Here is the minimal code to reproduce the issue.

from notifypy import Notify

n = Notify(enable_logging=True)
n.send()

The above code snippet results in the following notification on Arch Linux.
Screenshot_2023-12-03_21-10-08

While the output in stdout shows the following:

2023-12-03 21:22:11.679 | INFO     | notifypy.notify:__init__:50 - Logging is enabled.
2023-12-03 21:22:11.685 | INFO     | notifypy.os_notifiers.linux:<module>:16 - libnotify found, using it for notifications
2023-12-03 21:22:11.685 | DEBUG    | notifypy.os_notifiers.linux:<module>:28 - aplay binary not installed.. audio will not work!
2023-12-03 21:22:11.686 | DEBUG    | notifypy.os_notifiers.linux:send_notification:74 - Generated command: ['/usr/bin/notify-send', 'Default Title', 'Default Message', "--icon='/home/white/study/SDM404/Assessment 3/SDM404 Final Project/venv/lib/python3.11/site-packages/notifypy/py-logo.png'", "--app-name='Python Application (notify.py)'", '-u', 'normal']
2023-12-03 21:22:11.704 | INFO     | notifypy.notify:send_notification:351 - Sent notification.

It is because of unnecessary extra quotation while calling:

if notification_icon:
generated_command.append(f"--icon={shlex.quote(notification_icon)}")

According to the subprocess documentation, it takes over argument quotation if needed. After a small correction it works like a charm.

if notification_icon:
    generated_command.extend(['--icon', notification_icon])

if kwargs.get("application_name"):
    generated_command.extend(['--app-name', kwargs.get('application_name')])

Screenshot_2023-12-03_21-28-38

2023-12-03 21:25:46.435 | INFO     | notifypy.notify:__init__:50 - Logging is enabled.
2023-12-03 21:25:46.441 | INFO     | notifypy.os_notifiers.linux:<module>:16 - libnotify found, using it for notifications
2023-12-03 21:25:46.441 | DEBUG    | notifypy.os_notifiers.linux:<module>:28 - aplay binary not installed.. audio will not work!
2023-12-03 21:25:46.441 | DEBUG    | notifypy.os_notifiers.linux:send_notification:72 - Generated command: ['/usr/bin/notify-send', 'Default Title', 'Default Message', '--icon', '/home/white/study/SDM404/Assessment 3/SDM404 Final Project/venv/lib/python3.11/site-packages/notifypy/py-logo.png', '--app-name', 'Python Application (notify.py)', '-u', 'normal']
2023-12-03 21:25:46.457 | INFO     | notifypy.notify:send_notification:351 - Sent notification.

Release publishing workflow issues

I'm trying to package this python module for a Linux distro and there are some issues I've noticed with your published packages:

  1. Source releases don't include a copy of the MIT license
    the MIT license requires you provide a copy of the LICENSE file when you distribute your module
  2. Some releases published on PyPI aren't published on GitHub
    retrieving the source releases for packaging from GitHub brings lower maintenance overhead and better transparency than retrieving them from PyPI
  3. Release file naming isn't very packager friendly
    the module is named notify-py, yet the published release file names are notify_py, inconsistencies like this increase the verbosity of the packaging definitions and maintenance overhead

Unable to re-enable notifications for specific application name.

Reference

dynobo/normcap#87

Looks like if a user manually "turns off" the notification sent by notify-py. They are unable to "re-enable".
Need to find a workaround to allow the user to have the option to re-enable in the Windows Settings..

Current workaround is to simply change the application_name to something else each time you send a notification or when first initializing the Notify object..

Feature Request: Open Notification URLs in Chrome

OS: Windows 11

Description:
Whenever I click on a notification, I would like it to open the respective URL in the Google Chrome browser oe default browser.

Why it's valuable:
This feature would improve the user experience by allowing me to quickly access the content associated with notifications without having to manually copy and paste URLs into Chrome.

Application name is `notify-send` on Linux

If I use Notify().send() I get this notification:
obrazek
The application name is notify-send instead of Python Application (notify.py)
That could be fixed by adding application_name as a argument to LinuxNotifier.send_notification and adding

if application_name:
    generated_command.append(f"--app-name={shlex.quote(application_name)}")

this issue will be fixed in v0.3.2 when using Dbus, but not when using the legacy notifier.

Suppress logging output by default

When I am sending notification I get bunch of logging output into the terminal. Since this is a library people might not be really interested in this logging by default. For example, I am using it in CLI application and there it is very distracting and not required.

Can you please by default turn it off? Maybe it could be turned on with a flag in options of the constructor? Or environmental variable? I logging will be used only in debugging scenario.

Add on click callback

Hello. Could you add a cross-platform callback implementation when the notification is clicked (or add a button in notifications).
I think this would be very useful.

Unable to find required afplay - binaries not released?

First of all thanks for putting this together!

I wanted to use it for https://github.com/AuHau/toggl-cli but ran into problem where when I want to show notification I get:

Traceback (most recent call last):
...
  File "/Users/adam/Projects/me/toggl-cli/toggl/cli/commands.py", line 396, in notify
    notification = Notify()
  File "/Users/adam/Projects/me/toggl-cli/.direnv/python-3.8.1/lib/python3.8/site-packages/notifypy/notify.py", line 30, in __init__
    self._notifier = self._notifier_detect()
  File "/Users/adam/Projects/me/toggl-cli/.direnv/python-3.8.1/lib/python3.8/site-packages/notifypy/os_notifiers/macos.py", line 15, in __init__
    call_find_notificator = self._find_bundled_notificator()
  File "/Users/adam/Projects/me/toggl-cli/.direnv/python-3.8.1/lib/python3.8/site-packages/notifypy/os_notifiers/macos.py", line 40, in _find_bundled_notificator
    raise BinaryNotFound("afplay")
notifypy.exceptions.BinaryNotFound: Unable to find required afplay. Please check if it's installed.

I inspected the package and I see that it is still released with the snoretoast.exe and that the MacOs binary is not included. It seems bit weird but maybe you released old version?

Alarm in Windows?

I'm trying to create an alarm notification to get around fullscreen apps default setting. But what's an alarm?! Can we do this with notify-py?

Screenshot 2022-07-07 at 22 05 11

Not working on Windows 11 Pro x64 version 10.0.22621

upon running my code i get the following error:

Traceback (most recent call last):
File "main.py", line 69, in
notifier = Notifier(api)
^^^^^^^^^^^^^
File "main.py", line 54, in init
self.notify()
File "main.py", line 58, in notify
notification = Notify(
^^^^^^^
File "C:\Users\khaoo\AppData\Local\Programs\Python\Python312\Lib\site-packages\notifypy\notify.py", line 69, in init
self._notifier_detect = self._selected_notification_system()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\khaoo\AppData\Local\Programs\Python\Python312\Lib\site-packages\notifypy\notify.py", line 123, in _selected_notification_system
raise UnsupportedPlatform(
notifypy.exceptions.UnsupportedPlatform: This version of Windows (11) is not supported. is not supported.

WSL support

Hi! Thank you for this great packages!

It will be cool to have WSL support.

One way is to have an ability to send notifications using external tools i.e. wsl-notify-send:

image

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

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.