Skip to content

Use iwctl instead of netctl #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .bin/is.wifi.auto.running
Original file line number Diff line number Diff line change
@@ -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
7 changes: 1 addition & 6 deletions .bin/is.wifi.profile.running
Original file line number Diff line number Diff line change
@@ -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
9 changes: 2 additions & 7 deletions .bin/is.wifi.running
Original file line number Diff line number Diff line change
@@ -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
10 changes: 2 additions & 8 deletions .bin/wifi.any.stop
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions .bin/wifi.auto.start
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions .bin/wifi.auto.stop
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .bin/wifi.profile.start
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env sh

sudo /usr/bin/netctl start "$1"
iwctl station "$(wifi.chips.default)" connect "$1"
2 changes: 1 addition & 1 deletion .bin/wifi.profile.stop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env sh

sudo /usr/bin/netctl stop "$1"
wifi.any.stop
2 changes: 1 addition & 1 deletion .bin/wifi.profiles
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion .bin/wifi.profiles.running
Original file line number Diff line number Diff line change
@@ -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}'
4 changes: 1 addition & 3 deletions .bin/wifi.resume
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions .bin/wifi.stations
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

iwctl station list | tail +5 | head -1 | sed -e 's/^ *//' -e 's/ */ /g'
9 changes: 3 additions & 6 deletions .bin/wifi.status
Original file line number Diff line number Diff line change
@@ -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-wlp' ; 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
4 changes: 1 addition & 3 deletions .bin/wifi.suspend
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .bin/wifi.ui.profile.start
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

profiles=$(wifi.profiles | cut -b3-)
profiles=$(wifi.profiles)
profile=$(echo "$profiles" | dmenu_center --rest -z -p '' -sb '#85bd85' -i -t -l 10)

if [ "$profile" != '' ] ; then
Expand Down