|
2014-03-21
, 01:39
|
Posts: 144 |
Thanked: 242 times |
Joined on Nov 2007
@ Finland
|
#2
|
The Following User Says Thank You to Penguin For This Useful Post: | ||
|
2014-03-21
, 02:29
|
Posts: 959 |
Thanked: 3,427 times |
Joined on Apr 2012
|
#3
|
|
2014-03-21
, 03:24
|
Posts: 144 |
Thanked: 242 times |
Joined on Nov 2007
@ Finland
|
#4
|
|
2014-03-21
, 03:42
|
Posts: 959 |
Thanked: 3,427 times |
Joined on Apr 2012
|
#5
|
Can't you just set any ambiance from UI as in Jolla if you are running Sailfish OS in your device?
|
2014-03-21
, 03:45
|
Posts: 144 |
Thanked: 242 times |
Joined on Nov 2007
@ Finland
|
#6
|
|
2014-03-21
, 09:37
|
|
Posts: 5,339 |
Thanked: 4,133 times |
Joined on Jan 2010
@ Israel
|
#7
|
dbus-send --session --print-reply --dest=com.jolla.ambienced /com/jolla/ambienced com.jolla.ambienced.setAmbience string:"file://path/to/ambience"
The Following User Says Thank You to Schturman For This Useful Post: | ||
|
2014-03-26
, 08:12
|
|
Posts: 5,339 |
Thanked: 4,133 times |
Joined on Jan 2010
@ Israel
|
#8
|
grep 'ambience' /home/nemo/.gconf/desktop/meego/background/portrait/%gconf.xml|cut -d '/' -f6|cut -d '<' -f1
|
2014-03-26
, 09:32
|
Posts: 144 |
Thanked: 242 times |
Joined on Nov 2007
@ Finland
|
#9
|
gconftool-2 --get /desktop/meego/background/portrait/picture_filename
su - nemo -c "gconftool-2 --get /desktop/meego/background/portrait/picture_filename"
The Following User Says Thank You to Penguin For This Useful Post: | ||
|
2014-03-26
, 10:08
|
|
Posts: 5,339 |
Thanked: 4,133 times |
Joined on Jan 2010
@ Israel
|
#10
|
Now I that I got the whole thing to work, I thought I'd share it with you. Please note that this still involves rather a lot of console work.
At the heart of this custom ambience system is the following python script, let's call it custom_ambiences.py. This script first executes boot.sh (so that you can run something when your Jolla starts up), and then listens to the DBIS and executes $TOHID.sh when a TOH is attached. Besides that, it executes [I]$AMBIENCE_NAME[I].sh when a new ambience is selected. It looks for those scripts in /home/nemo/scripts.
The content of /home/nemo/scripts/custom_ambiences.py:
#!/usr/bin/python
def start_script(cmd):
try:
subprocess.Popen([cmd])
except OSError:
with open(cmd, "w") as text_file:
text_file.write("#!/bin/sh")
def start_toh_script(sender, dict, array):
if 'TOHID' in dict:
print dict['TOHID']
cmd = "/home/nemo/scripts/"+dict['TOHID']+".sh"
def start_ambience_script(var1,var2,var3,var4):
path= os.popen("gconftool-2 -g /desktop/meego/background/portrait/picture_filename").read()
path=path.split("/")
ambience=path[len(path)-1].split(".ambience")[0]
cmd="/home/nemo/scripts/"+ambience+".sh"
start_script(cmd)
import dbus, gobject, subprocess, os
from dbus.mainloop.glib import DBusGMainLoop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
session = dbus.SessionBus()
object = session.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications')
interface = dbus.Interface(object,'org.freedesktop.Notifications')
cmd = "/home/nemo/scripts/boot.sh"
subprocess.Popen([cmd])
bus.add_signal_receiver(start_toh_script,dbus_interface='org.freedesktop.DBus.Properties',path='/com/jolla/tohd')
session.add_signal_receiver(start_ambience_script,dbus_interface='com.nokia.profiled', path='/com/nokia/profiled')
loop = gobject.MainLoop()
loop.run()
[Unit]
Description=Run applications at startup
Requires=lipstick.service
After=lipstick.service
[Service]
Type=oneshot
ExecStart=/home/nemo/.config/systemd/scripts/autostart-apps
[Install]
WantedBy=post-user-session.target
#!/bin/sh -
invoker -n --type=generic /home/nemo/scripts/custom_ambiences.py
(I took this also from TJC)
And then you're good to go!
Some cool things you can do with this:
If you have any other ideas, I'd be glad to hear them.