Closed ant-222 closed 4 years ago
Hi! Thank you for the report. The weechat-notify-send
script runs notify-send
to send the notification, i.e. it does not use libnotify
directly, but rather a program that does the interaction with libnotify
. Here is the piece of code that does the call:
try:
subprocess.check_call(
notify_cmd,
stderr=subprocess.STDOUT,
stdout=devnull,
)
except Exception as ex:
error_message = '{} (reason: {!r}). {}'.format(
'Failed to send the notification via notify-send',
'{}: {}'.format(ex.__class__.__name__, ex),
'Ensure that you have notify-send installed in your system.',
)
print(error_message, file=sys.stderr)
So, when the notify-send [..]
call fails, an error message is reported in the main WeeChat's buffer by writing it to stderr
. If you do not see any errors there, it means that notify-send
returned 0 in your case (success). What happens if you run the following commands from a shell?
$ notify-send test me
$ echo $?
Does it print 0 or another number? If it prints 0, then I am afraid that there is nothing to do as return code 0 means that everything went OK. If you know a way (apart from rewriting the notification script to C, which I will not do), feel free to re-open and I can incorporate that into the script.
@s3rvac:
So, when the
notify-send [..]
call fails, an error message is reported in the main WeeChat's buffer by writing it tostderr
. If you do not see any errors there, it means thatnotify-send
returned 0 in your case (success). What happens if you run the following commands from a shell?$ notify-send test me $ echo $?
Does it print 0 or another number? If it prints 0, then I am afraid that there is nothing to do as return code 0 means that everything went OK. If you know a way (apart from rewriting the notification script to C, which I will not do), feel free to re-open and I can incorporate that into the script.
The first command has no visible effect, whereas the second one prints zero even as you suggested. I think I will to contact the maintainers of notify-send
about this one. Sorry for bothering you about it.
No worries. Maybe some other people will stumble upon this issue in the future, so it is good that we have documented it here.
Just for the record—it seems to be a bug in notify-send
, which is part of libnotify
. They not accepting issues for some reason, I have createad a pull request with a proposed fix. I wonder if they react to extermal PRs...
With
libnotify
installed, but no notification daemon available,weechat-notify-send
does not show an error whenever it fails to show a notification. I think it is to be expected that a program should report an error in case of any failure.I have written a small test program in C that tryies to display a notification via
libnotify
. It reports the following error:from the function
notify_notification_show()
. Doesweechat-notify-send
handle and report errors from this function in the Weechat client? If not, then I think it a bug and ask the developers to fix it, so that no error goes unnoticed.This is my test program: