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

Revision history [back]

click to hide/show revision 1
initial version

posted 2014-02-03 13:39:18 +0200

Use TOH to trigger shell scripts

I really like the idea of having different ambiances for different circumstances. I fear, however, that it will take the brave Jolla engineers quite some time to develop a more elaborate ambiance system.

One quick workaround would be to allow to trigger shell scripts when a TOH is replaced by another one. This shouldn't be too much work for Jolla, but would allow us to create our own crude ambiance system. Frankly, I don't know how much aspects of the phone you can control by CLI, e.g. changing the ambiance, but some basic linux stuff like vpn connection should be possible -- and this would be really helpful for me!

Use TOH to trigger shell scripts

I really like the idea of having different ambiances ambiences for different circumstances. I fear, however, that it will take the brave Jolla engineers quite some time to develop a more elaborate ambiance ambience system.

One quick workaround would be to allow to trigger shell scripts when a TOH is replaced by another one. This shouldn't be too much work for Jolla, but would allow us to create our own crude ambiance ambience system. Frankly, I don't know how much aspects of the phone you can control by CLI, e.g. changing the ambiance, ambience, but some basic linux stuff like vpn connection should be possible -- and this would be really helpful for me!

Use TOH to trigger shell scripts

I really like the idea of having different ambiences for different circumstances. I fear, however, that it will take the brave Jolla engineers quite some time to develop a more elaborate ambience system.

One quick workaround would be to allow to trigger shell scripts when a TOH is replaced by another one. This shouldn't be too much work for Jolla, but would allow us to create our own crude ambience system. Frankly, I don't know how much aspects of the phone you can control by CLI, e.g. changing the ambience, but some basic linux stuff like vpn connection should be possible -- and this would be really helpful for me!


Edit: I wrote a python script which takes the ID of a newly attached TOH and executes a shell script named $TOH_ID.sh. This was easier than I thought -- thanks again for your answers!

#!/usr/bin/env python

def start_toh_script(sender, dict, array):
        if 'TOHID' in dict:
                print dict['TOHID']
                cmd = "./"+dict['TOHID']+".sh"
                try:
                        subprocess.Popen([cmd])
                except OSError:
                        print 'Please create file: '+dict['TOHID']+'.sh'


import dbus, gobject, subprocess, os
from dbus.mainloop.glib import DBusGMainLoop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()

bus.add_signal_receiver(start_toh_script,dbus_interface='org.freedesktop.DBus.Properties',path='/com/jolla/tohd')

loop = gobject.MainLoop()
loop.run()

Use TOH to trigger shell scripts

I really like the idea of having different ambiences for different circumstances. I fear, however, that it will take the brave Jolla engineers quite some time to develop a more elaborate ambience system.

One quick workaround would be to allow to trigger shell scripts when a TOH is replaced by another one. This shouldn't be too much work for Jolla, but would allow us to create our own crude ambience system. Frankly, I don't know how much aspects of the phone you can control by CLI, e.g. changing the ambience, but some basic linux stuff like vpn connection should be possible -- and this would be really helpful for me!


Edit: I wrote a python script which takes the ID of a newly attached TOH and executes a shell script named $TOH_ID.sh. This was easier than I thought -- thanks again for your answers!

#!/usr/bin/env python

def start_toh_script(sender, dict, array):
        if 'TOHID' in dict:
                print dict['TOHID']
                cmd = "./"+dict['TOHID']+".sh"
                try:
                        subprocess.Popen([cmd])
                except OSError:
                        print 'Please create file: '+dict['TOHID']+'.sh'


import dbus, gobject, subprocess, os
from dbus.mainloop.glib import DBusGMainLoop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()

bus.add_signal_receiver(start_toh_script,dbus_interface='org.freedesktop.DBus.Properties',path='/com/jolla/tohd')

loop = gobject.MainLoop()
loop.run()

Use TOH to trigger shell scripts

I really like the idea of having different ambiences for different circumstances. I fear, however, that it will take the brave Jolla engineers quite some time to develop a more elaborate ambience system.

One quick workaround would be to allow to trigger shell scripts when a TOH is replaced by another one. This shouldn't be too much work for Jolla, but would allow us to create our own crude ambience system. Frankly, I don't know how much aspects of the phone you can control by CLI, e.g. changing the ambience, but some basic linux stuff like vpn connection should be possible -- and this would be really helpful for me!


Edit: I wrote a python script which takes the ID of a newly attached TOH and executes a shell script named $TOH_ID.sh. This was easier than I thought -- thanks again for your answers!

#!/usr/bin/env python

def start_toh_script(sender, dict, array):
        if 'TOHID' in dict:
                print dict['TOHID']
                cmd = "./"+dict['TOHID']+".sh"
                try:
                        subprocess.Popen([cmd])
                except OSError:
                        print 'Please create file: '+dict['TOHID']+'.sh'


import dbus, gobject, subprocess, os
from dbus.mainloop.glib import DBusGMainLoop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()

bus.add_signal_receiver(start_toh_script,dbus_interface='org.freedesktop.DBus.Properties',path='/com/jolla/tohd')

loop = gobject.MainLoop()
loop.run()