How can I switch ambiences with calendar events?

asked 2017-09-16 18:27:41 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2017-09-16 18:27:41 +0200

Ralf gravatar image

I'm still looking for a way to control my ambience with calendar entries. In according to the situation developer it is not possible because Sailfish does not provide a working calendar API for 3rd parties. I ask me when we can show the entries on lockscreen it must be possible to write a role for the app phonebot-0.1.5-10.30.2.jolla.armv7hl.rpm. I hope that someone can me give the first lines for it. My problem is, that I have many meetings. I was used to it by my N8 and N9, that the phone switches silent and then again loudly without which I must do what. Thanks in advance.

edit retag flag offensive close delete

Comments

Check if you can find a dbus message from a calendar event and hook to that.

juiceme ( 2017-09-16 20:43:20 +0200 )edit

It is important to me too

orol ( 2017-09-17 11:49:45 +0200 )edit

Very Cool Idea, would like to have it too

Christo ( 2017-09-17 12:38:45 +0200 )edit

I wrote this about the dbus but now I know that it is not possible. The dbus signals have not the time for stop the event. In the moment I try to insert some command lines in the file: /usr/share/lipstick-jolla-home-qt5/lockscreen/LockItem.qml but for a beginner it is not easy. This file was mod from the patch lockscreen-upcoming. The new file included attributes of start and stop time from calendar events. My problem is how I can get the real time. In Visual Basic it is called "now". I have to learn many new thinks in Linux. Maybe anybody can help me. The second question is if the service for lock screen run every time or only in lock screen modus. I'll get back when I'm successful...

Ralf ( 2017-09-17 17:05:32 +0200 )edit

Now I found the real file for Events and also the way for the actual time. The file is ShowCalEv.qml. The actual time I get with now = new Date and this can I compare with the event times.

I will test follow way in the file ShowCalEv.qml under "function update()":

for (var i = 0; i < allEvents.count; ++i) 
                {
                    var occurrence = allEvents.get(i, AgendaModel.OccurrenceObjectRole)
                    var event = allEvents.get(i, AgendaModel.EventObjectRole)
                if (i = 1 && now !== occurrence.startTime)
                {
                    dbus-send --session --print-reply --dest=com.jolla.ambienced /com/jolla/ambienced 
                    com.jolla.ambienced.setAmbience
                    string:'file:///usr/share/ambience/silent/silent.ambience'
                }
... and the the rest from this file.

For stop the same with end time. Could a specialist check this before I test it? I not sure if I can start dbus send commands from a qml file.

Thanks in advance.

Ralf ( 2017-09-17 17:54:52 +0200 )edit