From df5bc22cda35c4c5922332c1b59970bbcd6e3f98 Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 17 Aug 2024 19:15:02 +0100 Subject: [PATCH] [wifi_dmenu.sh]: add wifi_dmenu.sh --- README.md | 1 + wifi_dmenu.sh | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100755 wifi_dmenu.sh 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: "))