Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom icons are not showing on Linux #57

Open
white43 opened this issue Dec 3, 2023 · 0 comments
Open

Custom icons are not showing on Linux #57

white43 opened this issue Dec 3, 2023 · 0 comments

Comments

@white43
Copy link

white43 commented Dec 3, 2023

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.
white43 added a commit to white43/notify-py that referenced this issue Dec 3, 2023
@white43 white43 changed the title A custom icon is not showing on Linux Custom icons are not showing on Linux Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant