View Single Post
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#444
One more:

I modified the bluetooth status script to show the correct icon for connected or disconnected states. No icon is shown when BT is off.

Code:
#!/usr/bin/python
# Print bluetooth status icon off/disconnected/connected

import dbus

bus = dbus.SystemBus()

bluez = bus.get_object('org.bluez', '/')
adapter_path = bluez.ListAdapters(dbus_interface='org.bluez.Manager')[0]
adapter = bus.get_object('org.bluez', adapter_path)
powered = adapter.GetProperties(dbus_interface='org.bluez.Adapter')['Powered']
btstatus = bus.get_object('com.nokia.policy.pcfd', '/com/nokia/policy/bluetooth_override')
connected = btstatus.Get(dbus_interface='org.maemo.contextkit.Property')[0]

if powered:
    if 'default' in connected:
        print '<</usr/share/themes/blanco/meegotouch/icons/icon-s-status-bluetooth-active.png>>'
    else:
        print '<</usr/share/themes/blanco/meegotouch/icons/icon-s-status-bluetooth.png>>'
 

The Following 2 Users Say Thank You to slarti For This Useful Post: