diff --git a/.bin/ethernet.ui.profile.start b/.bin/ethernet.ui.profile.start index 4cdbe8eb..d40f1a95 100755 --- a/.bin/ethernet.ui.profile.start +++ b/.bin/ethernet.ui.profile.start @@ -1,4 +1,5 @@ #!/usr/bin/env sh wifi.any.stop +wifi.stop sudo /usr/bin/systemctl start dhcpcd diff --git a/.bin/is.wifi.auto.running b/.bin/is.wifi.auto.running index 864e11a3..fb830a81 100755 --- a/.bin/is.wifi.auto.running +++ b/.bin/is.wifi.auto.running @@ -1,8 +1,2 @@ #!/usr/bin/env dash -# shellcheck disable=SC2009 -ps -u root -o command | grep -q '[n]etctl/auto.action$' -#interface="$(wifi.chips.default)" -#systemctl | \ -#grep 'netctl-auto@'"$interface" | \ -#grep -e 'loaded\s*active\s*\(exited\|running\)' | \ -#grep -o 'netctl-auto@.*\.service' 1>&2 +is.wifi.running diff --git a/.bin/is.wifi.profile.running b/.bin/is.wifi.profile.running index 2127baeb..d383672a 100755 --- a/.bin/is.wifi.profile.running +++ b/.bin/is.wifi.profile.running @@ -1,8 +1,3 @@ #!/usr/bin/env sh -interface="$(wifi.chips.default)" - -systemctl | -grep 'netctl@'"$interface" | -grep -e 'loaded\s*active\s*\(exited\|running\)' | -grep -o 'netctl@.*\.service' 1>&2 +exit 1 diff --git a/.bin/is.wifi.running b/.bin/is.wifi.running index e3a6c0e9..d6c8d35b 100755 --- a/.bin/is.wifi.running +++ b/.bin/is.wifi.running @@ -1,8 +1,3 @@ #!/usr/bin/env dash -# shellcheck disable=SC2009 -ps -u root -o command | grep -q '[r]un/netctl/wpa_supplicant-wlp' -#interface="$(wifi.chips.default)" -#systemctl | \ -#grep 'netctl\(\|-auto\)@'"$interface" | \ -#grep -e 'loaded\s*active\s*\(exited\|running\)' | \ -#grep -o 'netctl\(\|-auto\)@.*\.service' 1>/dev/null +#ps -u root -o command | grep -q '^/usr/lib/iwd/iwd$' +systemctl is-active iwd > /dev/null diff --git a/.bin/wifi b/.bin/wifi index 8b5c2062..8600cb16 100755 --- a/.bin/wifi +++ b/.bin/wifi @@ -1,3 +1,3 @@ #!/usr/bin/env sh -sudo /usr/bin/wifi-menu "$@" +iwctl "$@" diff --git a/.bin/wifi.any.stop b/.bin/wifi.any.stop index b1f72a0a..7999cdb0 100755 --- a/.bin/wifi.any.stop +++ b/.bin/wifi.any.stop @@ -1,11 +1,5 @@ #!/usr/bin/env sh -profile="$(wifi.profiles.running)" +chip="$(wifi.chips.default)" -if [ "$profile" != '' ] ; then - wifi.profile.stop "$profile" -elif is.wifi.auto.running ; then - wifi.auto.stop -fi - -sudo /usr/bin/ip link set "$(wifi.chips.default)" down +iwctl station "$chip" disconnect diff --git a/.bin/wifi.auto.start b/.bin/wifi.auto.start index 4a282df9..db1edd92 100755 --- a/.bin/wifi.auto.start +++ b/.bin/wifi.auto.start @@ -1,5 +1,3 @@ #!/usr/bin/env sh -interface="$(wifi.chips.default)" - -sudo /usr/bin/systemctl start 'netctl-auto@'"$interface" +sudo /usr/bin/systemctl start iwd diff --git a/.bin/wifi.auto.stop b/.bin/wifi.auto.stop index 9188b17f..7950cdeb 100755 --- a/.bin/wifi.auto.stop +++ b/.bin/wifi.auto.stop @@ -1,5 +1,3 @@ #!/usr/bin/env sh -interface="$(wifi.chips.default)" - -sudo /usr/bin/systemctl stop 'netctl-auto@'"$interface" +sudo /usr/bin/systemctl stop iwd diff --git a/.bin/wifi.profile.start b/.bin/wifi.profile.start index bd132237..e3890af6 100755 --- a/.bin/wifi.profile.start +++ b/.bin/wifi.profile.start @@ -1,3 +1,3 @@ #!/usr/bin/env sh -sudo /usr/bin/netctl start "$1" +iwctl station "$(wifi.chips.default)" connect "$1" diff --git a/.bin/wifi.profile.stop b/.bin/wifi.profile.stop index 8d4a9b0e..9c5b95be 100755 --- a/.bin/wifi.profile.stop +++ b/.bin/wifi.profile.stop @@ -1,3 +1,3 @@ #!/usr/bin/env sh -sudo /usr/bin/netctl stop "$1" +wifi.any.stop diff --git a/.bin/wifi.profiles b/.bin/wifi.profiles index 38aac006..e3eae468 100755 --- a/.bin/wifi.profiles +++ b/.bin/wifi.profiles @@ -1,3 +1,3 @@ #!/usr/bin/env sh -netctl list +iwctl known-networks list | tail +5 | grep '^ [^ ]' | sed -e 's/^\s*//g' -e 's/\s*$//g' -e 's/\s\s*/ /g' | cut -d' ' -f1 diff --git a/.bin/wifi.profiles.running b/.bin/wifi.profiles.running index e8cbd05a..f25e225f 100755 --- a/.bin/wifi.profiles.running +++ b/.bin/wifi.profiles.running @@ -1,3 +1,7 @@ #!/usr/bin/env sh -wifi.profiles | grep '^\*' | sed 's/^\*\s*//' +interface="$(wifi.chips.default)" + +iwctl station "$interface" show | + grep 'Connected network' | + awk '{print $3}' diff --git a/.bin/wifi.resume b/.bin/wifi.resume index 925e0bfc..b6d932ec 100755 --- a/.bin/wifi.resume +++ b/.bin/wifi.resume @@ -1,10 +1,8 @@ #!/usr/bin/env sh -cache="${HOME}/.cache/netctl/last" +cache="${HOME}/.cache/iwctl/last" profile="$(cat "$cache")" -sudo /usr/bin/ip link set "$(wifi.chips.default)" down - if [ "$profile" = 'auto' ] ; then wifi.auto.start elif [ "$profile" != '' ] ; then diff --git a/.bin/wifi.start b/.bin/wifi.start new file mode 100755 index 00000000..9d7df6a5 --- /dev/null +++ b/.bin/wifi.start @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +ethernet.ui.profile.stop +sudo /usr/bin/systemctl start iwd diff --git a/.bin/wifi.stations b/.bin/wifi.stations new file mode 100755 index 00000000..e385eff3 --- /dev/null +++ b/.bin/wifi.stations @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +iwctl station list | tail +5 | head -1 | sed -e 's/^ *//' -e 's/ */ /g' diff --git a/.bin/wifi.status b/.bin/wifi.status index 5cee87c2..b1f18efb 100755 --- a/.bin/wifi.status +++ b/.bin/wifi.status @@ -1,12 +1,9 @@ #!/usr/bin/env dash export MEMOIZE_CACHE="/tmp/${USER}-memoize" -if memoize 0 ps -u root -o command | grep -q '[r]un/netctl/wpa_supplicant-[mw]l' ; then - if memoize-get -1 ps -u root -o command | grep -q '[n]etctl/auto.action$' ; then - printf '%s\n' auto - else - printf '%s\n' profile - fi +if memoize 0 ps -u root -o command | grep -q '[/]usr/lib/iwd/iwd' ; then + printf '%s\n' profile + #printf '%s\n' enabled else printf '%s\n' disabled fi diff --git a/.bin/wifi.stop b/.bin/wifi.stop new file mode 100755 index 00000000..7950cdeb --- /dev/null +++ b/.bin/wifi.stop @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +sudo /usr/bin/systemctl stop iwd diff --git a/.bin/wifi.suspend b/.bin/wifi.suspend index 6378ace9..a5143e79 100755 --- a/.bin/wifi.suspend +++ b/.bin/wifi.suspend @@ -1,6 +1,6 @@ #!/usr/bin/env sh -cache="${HOME}/.cache/netctl/last" +cache="${HOME}/.cache/iwctl/last" profile="$(wifi.profiles.running)" if [ "$profile" != '' ] ; then @@ -14,5 +14,3 @@ elif is.wifi.auto.running ; then else rm -f "$cache" fi - -sudo /usr/bin/ip link set "$(wifi.chips.default)" down diff --git a/.bin/wifi.ui.profile.start b/.bin/wifi.ui.profile.start index b209e62f..d9f81a05 100755 --- a/.bin/wifi.ui.profile.start +++ b/.bin/wifi.ui.profile.start @@ -1,10 +1,7 @@ #!/usr/bin/env sh -profiles=$(wifi.profiles | cut -b3-) -profile="$( - echo "$profiles" | \ - dmenu_center -p '' -sb '#85bd85' -sf '#333' -i -z -no-custom -fullscreen -)" +profiles=$(wifi.profiles) +profile=$(echo "$profiles" | dmenu_center --rest -z -p '' -sb '#85bd85' -i -t -l 10) if [ "$profile" != '' ] ; then ethernet.ui.profile.stop diff --git a/.config/i3/config b/.config/i3/config index e227d21a..f1babd8c 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -356,6 +356,10 @@ mode "wifi" { bindcode 40 exec wifi.ui.profile.stop; mode "default" #-- bindsym c exec wifi.ui.profile.start; mode "default" bindcode 54 exec wifi.ui.profile.start; mode "default" + #-- bindsym Shift+S exec wifi.stop; mode "default" + bindcode Shift+39 exec wifi.stop; mode "default" + #-- bindsym s exec wifi.start; mode "default" + bindcode 39 exec wifi.start; mode "default" #-- bindsym x exec menu.netctl.status; mode "default" bindcode 53 exec menu.netctl.status; mode "default"