mirror of
https://github.com/zhenyan121/dotfiles.git
synced 2026-04-10 14:34:09 +08:00
feat: 上传我的配置
This commit is contained in:
16
.config/waybar/scripts/toggle-bluetooth.sh
Executable file
16
.config/waybar/scripts/toggle-bluetooth.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
# 检查蓝牙的 rfkill 状态
|
||||
# 'rfkill list bluetooth' 会输出蓝牙设备的信息
|
||||
# 'grep -q "Soft blocked: yes"' 在输出中安静地 (-q) 查找 "Soft blocked: yes" 字符串
|
||||
|
||||
if rfkill list bluetooth | grep -q "Soft blocked: yes"; then
|
||||
# 如果找到了 "Soft blocked: yes" (说明蓝牙被软屏蔽了)
|
||||
# 则执行 unblock 命令来解锁
|
||||
rfkill unblock bluetooth
|
||||
# (可选) 发送一个通知,提供操作反馈
|
||||
else
|
||||
# 如果没有找到 "Soft blocked: yes" (说明蓝牙是开启的)
|
||||
# 则执行 block 命令来屏蔽
|
||||
rfkill block bluetooth
|
||||
# (可选) 发送通知
|
||||
fi
|
||||
Reference in New Issue
Block a user