From e94f33f4b0c8d14e06a9eb7dc4cb20eb1058ed93 Mon Sep 17 00:00:00 2001 From: xnm Date: Sat, 6 Apr 2024 01:26:01 +0300 Subject: [PATCH] airplane-mode bugfix --- home/.config/fish/functions/bluetooth_toggle.fish | 6 +++++- home/.config/fish/functions/wifi_toggle.fish | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/home/.config/fish/functions/bluetooth_toggle.fish b/home/.config/fish/functions/bluetooth_toggle.fish index f563f2c..4515efa 100644 --- a/home/.config/fish/functions/bluetooth_toggle.fish +++ b/home/.config/fish/functions/bluetooth_toggle.fish @@ -1,9 +1,13 @@ function bluetooth_toggle set bluetooth_status (rfkill list bluetooth | grep -i -o "Soft blocked: yes") + set backup_file ~/.cache/airplane_backup if [ -z "$bluetooth_status" ] rfkill block bluetooth else rfkill unblock bluetooth + if test -e $backup_file + rm $backup_file + end end -end \ No newline at end of file +end diff --git a/home/.config/fish/functions/wifi_toggle.fish b/home/.config/fish/functions/wifi_toggle.fish index 97f7e92..ee34fe2 100644 --- a/home/.config/fish/functions/wifi_toggle.fish +++ b/home/.config/fish/functions/wifi_toggle.fish @@ -1,9 +1,13 @@ function wifi_toggle set wifi_status (nmcli radio wifi) + set backup_file ~/.cache/airplane_backup - if [ "$wifi_status" = "enabled" ] + if [ "$wifi_status" = enabled ] nmcli radio wifi off else nmcli radio wifi on + if test -e $backup_file + rm $backup_file + end end -end \ No newline at end of file +end