From a406f9699965439c475e7770eb4314d5cbe6e301 Mon Sep 17 00:00:00 2001 From: Adrian Amaglio Date: Thu, 24 Feb 2022 16:46:22 +0100 Subject: [PATCH] update --- discord | 2 ++ switch-vpn | 3 +++ wifi_chooser | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100755 discord create mode 100755 wifi_chooser diff --git a/discord b/discord new file mode 100755 index 0000000..711f928 --- /dev/null +++ b/discord @@ -0,0 +1,2 @@ +#!/bin/sh +surf https://discord.com/channels/@me diff --git a/switch-vpn b/switch-vpn index edaabcb..6b6c906 100755 --- a/switch-vpn +++ b/switch-vpn @@ -4,3 +4,6 @@ if [ -n "$(nmcli connection show rezine_vpn37_udp | grep activated)" ] ; then else nmcli connection up rezine_vpn37_udp fi + +nmcli connection show rezine_vpn37_udp | grep 'VPN connected' &>/dev/null +[ "$?" -eq 0 ] && notify-send 'VPN UDP connecté' || notify-send 'VPN UDP stoppé' diff --git a/wifi_chooser b/wifi_chooser new file mode 100755 index 0000000..5ac8bb1 --- /dev/null +++ b/wifi_chooser @@ -0,0 +1,33 @@ +#!/bin/sh +# choose a wifi signal in range and try to connect to it + +verb=0 + +title="Wifi Selector" +id="" +notify () { + if [ -z "$id" ] ; then + id="$(dunstify -p "$title" "$@")" + else + dunstify -r "$id" "$title" "$@" + fi +} + +if ( nmcli radio wifi | grep disabled > /dev/null ) ; then + notify "Turning on" + nmcli radio wifi on + sleep 1 +fi + +notify "Scanning networks in range..." +nmcli device wifi rescan + +ssid=$(nmcli -f IN-USE,SSID,BARS d wifi list | dmenu -l 8 | tr -s '*' ' ' | rev | cut -d ' ' -f 3- | rev | cut -d ' ' -f 2-) + +[ $verb -gt 0 ] && echo ssid: $ssid +[ -z "$ssid" ] && notify "No SSID selected" && exit 1 + +notify "Connecting to $ssid" +out="$(nmcli d wifi connect "$ssid" | grep -i error)" +res="$?" +[ "$res" -ne 0 ] && notify "Connected :)" || notify "Error connecting :(\n$out"