summary refs log tree commit diff
path: root/bin/connmenu
diff options
context:
space:
mode:
Diffstat (limited to 'bin/connmenu')
-rwxr-xr-xbin/connmenu76
1 files changed, 46 insertions, 30 deletions
diff --git a/bin/connmenu b/bin/connmenu
index d3285dc..9faa5de 100755
--- a/bin/connmenu
+++ b/bin/connmenu
@@ -25,10 +25,13 @@ notifysend() {
 	[ -z "$notifyicon" ] && notifyicon=wifi
 	local msg=$1
 	shift 1
+	echo "$msg"
 	notification_id=$(notify-send "connman" "$msg" -i "$(iconez -sn "$notifyicon")" --print-id "$@")
 }
 
 get_services() {
+	# if [[ -f $SCAN_RESULT ]] && [[ $(($(date +%s) - $(stat -c %Y $SCAN_RESULT))) -gt 9000 ]]; then
+
 	if [[ -f $SCAN_RESULT ]]; then
 		notifysend 'another connman_dmenu is running'
 		exit 1
@@ -38,7 +41,7 @@ get_services() {
 	local notifyicon=wifi-sync
 	notifysend "scanning for wifi services..." --expire-time=0
 
-	trap "rm -f $SCAN_RESULT" EXIT
+	trap 'rm -f $SCAN_RESULT' EXIT
 	connmanctl enable wifi &>/dev/null
 	connmanctl scan wifi &>/dev/null
 	clear-notification "$notification_id"
@@ -163,43 +166,56 @@ security="$(get_service_security "$service_id")"
 
 # create service file for encryption
 if [[ ! "$name" =~ ^\* ]] && [[ "$security" =~ ^(ieee8021x|psk|wep)$ ]]; then
-	notifysend 'setting up connection not implemented' -c error
-	# config_file="$STORAGE_PATH/$name-$security.config"
+	swx -t connmanctl
+	wtype -s 200 "agent on"
+	wtype -s 200 -k enter
+	wtype -s 200 "connect $service_id"
+	wtype -s 200 -k enter
+
+	# config_file="$STORAGE_PATH/$service_id/settings"
 	# if [[ -f "$config_file" && no != "$(echo -e 'yes\nno' | dmenu -p '󱛆 use previous profile?')" ]]; then
 	# 	echo "use old profile: $config_file"
 	# else
+	# 	password=
 	# 	dmenu_ask 'please provide password' password --password
+	# 	[ -n "$password" ] || exit 1
+	#
 	# 	case "$security" in
 	# 	ieee8021x)
-	# 		dmenu_ask 'please provide identity' identity
-	# 		case "$(echo -e 'PEAP/MSCHAPV2\nTTLS/PAP' | dmenu -p '󱛆 please specify EAP type')" in
-	# 		PEAP/MSCHAPV2)
-	# 			eap=peap
-	# 			phase2=MSCHAPV2
-	# 			;;
-	# 		TTLS/PAP)
-	# 			eap=ttls
-	# 			phase2=PAP
-	# 			;;
-	# 		*)
-	# 			(
-	# 				notifyicon=wifi-alert
-	# 				notifysend 'invalid EAP' -c error
-	# 			)
-	# 			exit 1
-	# 			;;
-	# 		esac
-	# 		cat >"$config_file" <<-EOF
-	# 			[service_$service_id]
-	# 			Type = wifi
-	# 			Name = $name
-	# 			EAP = $eap
-	# 			Phase2 = $phase2
-	# 			Identity = $identity
-	# 			Passphrase = $password
-	# 		EOF
+	# 		notifysend "unable to setup $security networks" -c error
+	# 		exit 1
+	#
+	# 		# dmenu_ask 'please provide identity' identity
+	# 		# case "$(echo -e 'PEAP/MSCHAPV2\nTTLS/PAP' | dmenu -p '󱛆 please specify EAP type')" in
+	# 		# PEAP/MSCHAPV2)
+	# 		# 	eap=peap
+	# 		# 	phase2=MSCHAPV2
+	# 		# 	;;
+	# 		# TTLS/PAP)
+	# 		# 	eap=ttls
+	# 		# 	phase2=PAP
+	# 		# 	;;
+	# 		# *)
+	# 		# 	(
+	# 		# 		notifyicon=wifi-alert
+	# 		# 		notifysend 'invalid EAP' -c error
+	# 		# 	)
+	# 		# 	exit 1
+	# 		# 	;;
+	# 		# esac
+	# 		# mkdir -p "$(dirname "$config_file")"
+	# 		# cat >"$config_file" <<-EOF
+	# 		# 	[service_$service_id]
+	# 		# 	Type = wifi
+	# 		# 	Name = $name
+	# 		# 	EAP = $eap
+	# 		# 	Phase2 = $phase2
+	# 		# 	Identity = $identity
+	# 		# 	Passphrase = $password
+	# 		# EOF
 	# 		;;
 	# 	psk | wep)
+	# 		mkdir -p "$(dirname "$config_file")"
 	# 		cat >"$config_file" <<-EOF
 	# 			[service_$service_id]
 	# 			Type = wifi