acpi events und notify-send

Hi,

ich würde gerne mittels notify-send auf ein ACPI Event hin eine Popup-Message an eingeloggte User schicken. Wenn ich Fn+F5 drücke werden der Reihe nach alle möglichen Kombinationen aus Bluetooth (AN/AUS) und WLAN (AN/AUS) durchgespielt. Dazu möchte ich jeweils ne Message bekommen was gerade Sache ist - also zB "Bluetooth ON / WLAN OFF" oder sowas.

Hab schon "notify-send .." in /etc/acpi/ibm-wireless.sh eingebaut, aber das läuft nicht.

Ideen?

cu
serow
 
Naja halt einfach reingeklatscht:

Code:
#!/bin/sh
# Find and toggle wireless of bluetooth devices on ThinkPads

. /usr/share/acpi-support/state-funcs

BLUETOOTH=/proc/acpi/ibm/bluetooth

if [ -r $BLUETOOTH ]; then
    grep -q disabled $BLUETOOTH
    bluetooth_state=$?
fi

# Note that this always alters the state of the wireless!
toggleAllWirelessStates;

# Sequence is Both on, Bluetooth only, Wireless only, Both off
if ! isAnyWirelessPoweredOn; then
    # Wireless was turned off
    if [ -w $BLUETOOTH ]; then
        if [ "$bluetooth_state" = 0 ]; then
            echo enable > $BLUETOOTH;
            notify-send "bluetooth on"
        else
            echo disable > $BLUETOOTH
            notify-send "bluetooth off"
        fi
    fi
fi
 
Ggf. musst du die Urgency noch festlegen und wenn nicht nur root die Nachrichten bekommen soll, auch noch ein 'sudo -u $SUDO_USER' davor setzen. 'sudo' muss natürlich entsprechend konfiguriert sein.
 
Hi,

also das "sudo -u mathias" vor dem notify-send führt nur zu folgender Meldung wenn ichs in nem Terminal ausführe:

libnotify-Message: UNable to get session bus: Faild to connect to socket /tmp/dbus-6mNjAF8TxJ

Die urgency setzen ist nicht notwendig. Jedenfalls klappts aus dem Terminal heraus ohne.


EDIT:
Ich war zu der Zeit per ssh auf den Laptop verbunden wo die messages hätten kommen sollen. Die Messages sind dann seltsamerweise auf dem anderen PC gelandet. Wahrscheinlich wegen ssh -X oder so. Jedenfalls gehts jetzt.
 
Zurück
Oben