Add password feature to netctrl

This commit is contained in:
speediegq 2022-08-23 15:25:07 +02:00
parent f88901a274
commit 1cdacfcab3

View file

@ -9,8 +9,21 @@ esac
BINDIR=$(cat /usr/share/speedwm-bindir)
SHOW_PASSWORD="true"
test ${BINDIR}iwctl || exit 0
if [ -e "$HOME/.config/speedwm-de/netctrl/config" ]; then
. $HOME/.config/speedwm-de/netctrl/config
else
mkdir -p $HOME/.config/speedwm-de/netctrl
printf "SHOW_PASSWORD=$SHOW_PASSWORD # Show password when entering it or not? Requires the 'password' dmenu patch. If you do not have it, you can get my build (true/false)" > $HOME/.config/speedwm-de/netctrl/config
fi
if [ "$SHOW_PASSWORD" = "false" ]; then
PASS_ARG="-P"
fi
# Get the device used to connect.
getdevice() {
seldevice=$1
@ -40,7 +53,7 @@ connectwifi() {
iwctl station $seldevice get-networks | grep "$network" > /dev/null || exit 1
connect_pass() {
PASSPHRASE=$(printf "\n" | $RUNLAUNCHER -p "This network is protected. Enter the passphrase." -l 1 -g 1)
PASSPHRASE=$(printf "\n" | $RUNLAUNCHER -p "This network is protected. Enter the passphrase." -l 1 -g 1 $PASS_ARG)
case "$PASSPHRASE" in
"") exit 0 ;;
esac