maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Getting unread notifications from script (https://talk.maemo.org/showthread.php?t=94594)

Self-Perfection 2015-02-10 09:54

Getting unread notifications from script
 
It is possible to send notfications with D-Bus.

But how can I get unread notifications from script?

I would like to add printing unread notifications titles to my .bash_profile to see what I have missed when I SSH to my Jolla.

javispedro 2015-02-10 15:49

Re: Getting unread notifications from script
 
This is possible with a non-standard Lipstick extension to the notification interface:

https://github.com/nemomobile/lipsti...anager.xml#L39

Unfortunately the complicated type of the return value from that function might make reading from the command line difficult. I hope someone figures it out.

coderus 2015-02-10 16:19

Re: Getting unread notifications from script
 
easier just creqte qt helper who will print you notifications, but you may use python also

Self-Perfection 2015-02-10 16:49

Re: Getting unread notifications from script
 
Thank you for the pointers. I got a bit further

To get list of e-mail notifications:
Code:

dbus-send --print-reply --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.GetNotifications string:"messageserver5"
Unfortunately this interface requires specifying application name to get notifications.

Ewww, I would like to find a way to get just all notifications.

ejjoman 2015-02-10 22:51

Re: Getting unread notifications from script
 
I'm working on a little Qt console application for this :)

How should the output look like? Any suggestions?
Currently, I iterate simply over the list and print something like:
Code:

1: Incoming: 192.168.10.10
2: Incoming: 192.168.10.10
3: Incoming: 192.168.10.10
4: Incoming: 192.168.10.10
5:
6: Incoming: 192.168.10.10
7: Incoming: 192.168.10.10
8: Incoming: 192.168.10.10
9: Incoming: 192.168.10.10
10: Incoming: 192.168.10.10
11: Incoming: 192.168.10.10
12: Incoming: 192.168.10.10
13: Incoming: 192.168.10.10
14: Incoming: 192.168.10.10
15: Incoming: 192.168.10.10
16: Incoming: 192.168.10.10
17: Incoming: 192.168.10.10
18: Incoming: 192.168.10.10
19: Incoming: 192.168.10.10
20: Dein Konto xxx@xxx.org muss aktualisiert werden
21: Incoming: 192.168.10.10
22: Incoming: 192.168.10.10
23: Incoming: 192.168.10.10
24: Incoming: 192.168.10.10
25: Incoming: 192.168.10.10
26: 1 Datei heruntergeladen
27: Incoming: 192.168.10.10
28: Incoming: 192.168.10.10
29: Incoming: 192.168.10.10
30: Humble Bundle
31: Incoming: 192.168.10.10
32: Incoming: 192.168.10.10
33: Incoming: 192.168.10.10
34: Incoming: 192.168.10.10
35: Incoming: 192.168.10.10
36: Incoming: 192.168.10.10
37: Incoming: 192.168.10.10
38: Incoming: 192.168.10.10
39: Incoming: 192.168.10.10
40: Incoming: 192.168.10.10
41: Incoming: 192.168.10.10
42: Incoming: 192.168.10.10
43: Incoming: 192.168.10.10
44: Incoming: 192.168.10.10


coderus 2015-02-10 22:55

Re: Getting unread notifications from script
 
you need to add appname here

Self-Perfection 2015-02-11 11:19

Re: Getting unread notifications from script
 
Quote:

Originally Posted by ejjoman (Post 1460359)
I'm working on a little Qt console application for this :)

How should the output look like? Any suggestions?

I would like to be able to specify output format by myself with comman line switches. Consider adding --format switch with some substitute variables like this:
%a - application name
%t - message title
%b - message body
%c - count
%i - id
%ps - preview summary
%pb - preview body
<here should be a few more>

As default format I propose following string
"%a - %c %t\n%b\n\n"

It should be handy to add a couple shorthand switches for common variants of requests. Like --oneline for
--format "%a - %c %t\n"
and --raw for complete listing of all parameters of notification.


All times are GMT. The time now is 23:18.

vBulletin® Version 3.8.8