#!/bin/sh #Function to check status originaly created by Paul Sladen for Ubuntu acpi-support package isAnyWirelessPoweredOn() { for DEVICE in /sys/class/net/* ; do if [ -d $DEVICE/wireless ]; then # Hurray for stable interfaces... now the rfkill is scarcely # associated with the network device at all (!) for RFKILL in $DEVICE/device/rfkill/rfkill*/state; do if [ -r "$RFKILL" ] && [ "$(cat "$RFKILL")" -eq 1 ] then return 0 fi done # if any of the wireless devices are turned on then return success if [ -r $DEVICE/device/power/state ] && [ "`cat $DEVICE/device/power/state`" -eq 0 ] then return 0 fi if [ -r $DEVICE/device/rf_kill ] && [ "`cat $DEVICE/device/rf_kill`" -eq 0 ] then return 0 fi fi done # otherwise return failure return 1 } if (isAnyWirelessPoweredOn); then kdialog --passivepopup "Wyłączam Interfejsy bezprzewodowe" --title "Wciśnięty przycisk Wifi" else kdialog --passivepopup "Włączam Interfejsy bezprzewodowe" --title "Wciśnięty przycisk Wifi" fi sudo /usr/local/bin/wireless-toggle.sh if (isAnyWirelessPoweredOn); then sudo /usr/local/bin/wireless-led.sh 1 else sudo /usr/local/bin/wireless-led.sh 0 fi