Files
configs/wofi/wifi/wifi.sh
T
2026-04-18 15:05:01 +01:00

19 lines
698 B
Bash
Executable File

#!/bin/bash
# TO CONNECT TO WIFI USING DMENU | ROFI WHICH IS CONNECTED BEFORE
# bssid=$(nmcli device wifi list | sed -n '1!P'| cut -b 9- | dmenu -p "Wifi" -l 10 | awk '{print $1}')
dir="$HOME/.config/wofi"
theme='style-1'
# [ -z "$bssid" ] && exit 1
# nmcli device wifi connect $bssid
# notify-send "📶 WiFi Connected"
bssid=$(nmcli device wifi list | sed -n '1!P'| cut -b 9- | wofi --dmenu --style ${dir}/${theme}.css -p " " --lines 10 | awk '{print $1}')
[ -z "$bssid" ] && exit 1
if nmcli device wifi connect "$bssid"; then
notify-send "📶 WiFi Connected" "Successfully connected to network."
else
notify-send -u critical "⚠️ WiFi Error" "Failed to connect to network."
fi