diff --git a/README.md b/README.md index ba0e313..67e0a37 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,4 @@ laptop to my phone. - `trippy.sh`: script that displays random visual data to the screen (only works when called from a TTY, by a user who has write access to the `fb0` device, e.g. `root`). - `webcam.sh`: one-line script that uses the video viewer program `mpv` as a webcam by using `/dev/video0` as its video file source. + - `wifi_dmenu.sh`: script to connect to an available WiFi network with a dmenu prompt. diff --git a/wifi_dmenu.sh b/wifi_dmenu.sh new file mode 100755 index 0000000..130d9ee --- /dev/null +++ b/wifi_dmenu.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Script to connect to an available WiFi network with a dmenu prompt. + +notify-send "$(basename "$0")" "Scanning for available networks..." + +# cutting the first 9 characters of the nmcli output as it will contain empty fields which will mess up awk parsing +$(nmcli connection up $( nmcli device wifi list | cut --characters=9- | awk '(NR > 1){ print $2}' | sort | uniq | dmenu -p "Connect to network: "))