killswitch-applet-0.1 … or my personal Hello World in Python

One thing that was on my TODO for already quite some time was to have a look at that half-new language called Python. Because an old-fashioned “Hello World” is far too simple here, I was looking for some kind of project to get familiar with the basic principles.

One thing I found quite annoying in the past was the fact that I always had to disable some kind of radios in some far too complicated ways to save some battery power. Modern laptops often have multiple killswitches for their wireless communication devices like bluetooth, WLAN or WWAN. So that was the chance for me to seize, and the output looks like this:

killswitch-applet

From the README:

killswitch-applet is a small application sitting in the system tray providing the possibility to manage all the killswitches found in the system. In this context, “managing” means enabling or disabling certain killswitches. This is especially useful if you have multiple killswitches like bluetooth, WWAN or WLAN seen in many modern laptops.

Tray Icon on the Left
Tray Icon on the Left

The source tarball for version 0.1 can be downloaded here: killswitch-applet-0.1

The summary here definitely is: Wow, that was damn simple! Especially when it comes down to GTK programming and D-Bus interaction, Python definitely provides a very good way to hack those things together quite easily. The whole source file contains a whole of 189 lines of code including comments.

Another question: Is it worth creating a sourceforge project for this? I’ll wait until and if I’m getting some feedback.

Note for openSUSE users:

Of course this is also available in the openSUSE Buildservice. Go to http://software.opensuse.org/search and search for “killswitch-applet”.

One Response to “killswitch-applet-0.1 … or my personal Hello World in Python”

  1. bstecklu says:

    Hallo Holger, habe das applet auf meinem XPS M1330 mit Ubuntu 8.10 probiert. Klappt aber noch nicht. Die 3 switches (WLAN, WWAN, Bluetooth) werden nicht erkannt. Z.B. liefert lshal -u dell_wlan_switch

    udi = ‘/org/freedesktop/Hal/devices/dell_wlan_switch’
    info.capabilities = {’killswitch’} (string list)
    info.category = ‘killswitch’ (string)
    info.interfaces = {’org.freedesktop.Hal.Device.KillSwitch’} (string list)
    info.parent = ‘/org/freedesktop/Hal/devices/platform_dcdbas’ (string)
    info.product = ‘Dell WLAN Switch’ (string)
    info.subsystem = ‘unknown’ (string)
    info.udi = ‘/org/freedesktop/Hal/devices/dell_wlan_switch’ (string)
    killswitch.access_method = ‘dell’ (string)
    killswitch.type = ‘wlan’ (string)
    org.freedesktop.Hal.Device.KillSwitch.method_argnames = {’power’, ”} (string list)
    org.freedesktop.Hal.Device.KillSwitch.method_execpaths = {’hal-system-killswitch-set-power’, ‘hal-system-killswitch-get-power’} (string list)
    org.freedesktop.Hal.Device.KillSwitch.method_names = {’SetPower’, ‘GetPower’} (string list)
    org.freedesktop.Hal.Device.KillSwitch.method_signatures = {’b', ”} (string list)

    Wie kann ich das script dafür anpassen? Ersetzen von killswitch.name durch killswitch.type brachte keinen Erfolg.

Leave a Reply