#!/bin/bash
blocked=`/usr/sbin/rfkill list wlan | grep "Soft blocked: yes"`
user=`ps aux | grep knotify4 | grep -v grep | cut -d " " -f1`
if [ -z "$blocked" ]; then
/usr/sbin/rfkill block wlan
/usr/sbin/rfkill block bluetooth
sudo -u $user notify-send 'Wireless and Bluetooth' 'Periferiche Wireless e Bluetooth disattivate.' -t 1500
else
/usr/sbin/rfkill unblock wlan
/usr/sbin/rfkill unblock bluetooth
sudo -u $user notify-send 'Wireless and Bluetooth' 'Periferiche Wireless e Bluetooth attive.' -t 1500
fi