We have moved to a new Sailfish OS Forum. Please start new discussions there.
5

How to use the little notification popup?

asked 2015-07-26 13:12:21 +0300

Hey there, how can I use the little notification popup, like it is used in the clock app when you set an alarm? I can't find any info about it :(

edit retag flag offensive close delete

Comments

Hi. What do you mean by 'use'? Do you think of app development? In this case, you might have a look at e.g. harbour-tasklist (github) and search the source code for 'notification' for an example usage...

yurumi ( 2015-07-26 17:52:10 +0300 )edit

I'm not sure if it's working this way, but you can find this on /usr/share/jolla-clock/pages/MainPage.qml: It uses notification.previewBody = and notification.publish() for the alarm expiration notifications.

AliN ( 2015-07-27 16:30:16 +0300 )edit

2 Answers

Sort by » oldest newest most voted
4

answered 2015-07-26 20:36:56 +0300

Schturman gravatar image

You also can create simple python script like in this example and run it as USER: python /path/myscript.py

#!/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-m-notifications",
                 "Charging started",
                 "Charging starter",
                 dbus.Array(["default", ""]),
                 dbus.Dictionary({"x-nemo-preview-body": "Charging started",
                                  "category": "x-nemo.battery"},
                                  signature='sv'),
                 0)
edit flag offensive delete publish link more
0

answered 2015-07-28 20:26:25 +0300

Thanks for your answers. With 'use' i did mean for app development. I'm using nemo-qml-plugin-notifications right now, and it works great. But i am wondering if it is allowed to define my own notification categorys for Lipstick. I want to ship my own category config with my *.rpm and install it into "/usr/share/lipstick/notificationcategories". But i don't know how do name it, is something like "harbour.soundboard.favorite.conf" ok? ('soundboard' is the name of my app, and 'favorite' is the name of the category)

edit flag offensive delete publish link more

Comments

Notice that the nemo-qml-plugin-notifications is not currently allowed in harbour.

https://lists.sailfishos.org/pipermail/devel/2014-June/004635.html

Tanghus ( 2015-07-30 20:31:20 +0300 )edit
Login/Signup to Answer

Question tools

Follow
5 followers

Stats

Asked: 2015-07-26 13:12:21 +0300

Seen: 827 times

Last updated: Jul 28 '15