mis*_*ben 14
此脚本将切换状态,并显示一条消息以确认已完成的操作。
#!/bin/bash
if [ $(rfkill list wifi | grep "Soft blocked: yes" | wc -l) -gt 0 ] ; then
rfkill unblock wifi
zenity --info --text "Enabled wireless"
else
rfkill block wifi
zenity --info --text "Disabled wireless"
fi
Run Code Online (Sandbox Code Playgroud)
要让 zenity 提示消失,请像这样更改它们:
zenity --info --text "Enabled wireless" --timeout="5"
zenity --info --text "Disabled wireless" --timeout="5"
Run Code Online (Sandbox Code Playgroud)
或者发送出现在屏幕角落的通知。 
sudo apt-get install libnotify-bin
Run Code Online (Sandbox Code Playgroud)
将 zenity 线替换为
notify-send -i network-wireless-full "Wireless enabled" "Your wireless adaptor has been enabled."
notify-send -i network-wireless-disconnected "Wireless disabled" "Your wireless adaptor has been disabled."
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8227 次 |
| 最近记录: |