View Single Post
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#50
Originally Posted by Zeta View Post
Good !
So you succeed in using the trick r0kk3rz gave me (as described in a post in first page) !
I didn't take the time to make an app of it.
Hi
Not really...

Originally Posted by Zeta View Post
What I thought when tried the notification, was that we can give a command to run when clicking on the notification. In this case an open-ui and call the voicemail number would be great. The voicemail number can be retrieved directly from the ofono message waiting structure.
This is exactly what I want to do, but don't know how to implement it into my python notification script. If you can help me, would be nice.

Here is how I did it...
1. I got some help from VDVsx (https://together.jolla.com/question/...-command-line/)

2. My python script:
Code:
#!/usr/bin/python
import dbus

bus = dbus.SessionBus()
object = bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications')
interface = dbus.Interface(object,'org.freedesktop.Notifications')
#print(interface.GetCapabilities())

interface.Notify("app_name",
                 0,
                 "icon-lock-voicemail",
                 "You have Voice Mail !",
                 "Voicemail notifer",
                 dbus.Array(["default", ""]),
                 dbus.Dictionary({"x-nemo-preview-body": "Voicemail notifer",
                                  "x-nemo-preview-summary": "You have Voice Mail !",
                                  "category": "x-nemo.messaging.voicemail"},
                                  signature='sv'),
                 0)
Don't know how to implement here option for calling to voicemail by pressing on the notification. If you know would be great.

3. My script that daemon start:
Code:
#!/bin/bash

while true
do

time=$(cat /usr/share/openrepos-voicemailnotifer/time)

mailstatus=$(/usr/lib/qt5/bin/qdbus --system org.ofono /ril_0  org.ofono.MessageWaiting.GetProperties|grep Waiting|awk '{print $2}')

if [[ $mailstatus == "true" ]]; then
    pid=$(sqlite3 /home/nemo/.local/share/system/privileged/Notifications/notifications.db "select * from notifications;"|grep "lock-voicemail"|cut -d '|' -f1)
    if [[ $pid == "" ]]; then
     su -l nemo -c "python /usr/share/openrepos-voicemailnotifer/notifer3.py"
     else
     : 
    fi
   else
       pid=$(sqlite3 /home/nemo/.local/share/system/privileged/Notifications/notifications.db "select * from notifications;"|grep "lock-voicemail"|cut -d '|' -f1)
       if [[ $pid == "" ]]; then
         : 
         else
         su -l nemo -c "notificationtool -o remove -i $pid"
       fi
fi

sleep $time
done
4. The "time" file include 20s - checking time interval.

That all

P.S. I'm not programmer, I just like scripting a little bit

If someone want to try my package, you can download here: https://dl.dropboxusercontent.com/u/...-1.armv7hl.rpm
Installation automatically activate it, you can deactivate it by pressing on the icon. Remove package from terminal as ROOT:
Code:
pkcon remove voicemailnotifer
Or long press on the icon and "x".
 

The Following 4 Users Say Thank You to Schturman For This Useful Post: