Skip to content

Instantly share code, notes, and snippets.

@florian-h05
Created July 18, 2023 16:07
Show Gist options
  • Save florian-h05/09c87f043f929fb0a53db5597cbc6f9f to your computer and use it in GitHub Desktop.
Save florian-h05/09c87f043f929fb0a53db5597cbc6f9f to your computer and use it in GitHub Desktop.
Toggle airplane mode on Linux using rfkill.
#!/bin/bash
# Purpose: Toggle airplane mode.
# Usage: KDE Setting -> Shortcuts -> Add command -> Call this script "bash filename"
wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')"
if [ "$wifi" == "enabled" ]
then
rfkill block all
else
rfkill unblock all
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment