user/eww: use iwd tools instead of nmcli
Some checks failed
CI / Build linux-lava for x86_64-linux (push) Has been cancelled
Some checks failed
CI / Build linux-lava for x86_64-linux (push) Has been cancelled
This commit is contained in:
parent
e7588e0be0
commit
cc2e9d1a90
3 changed files with 16 additions and 33 deletions
|
|
@ -21,7 +21,7 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
home.packages = with pkgs; [ socat ];
|
home.packages = with pkgs; [ iw socat ];
|
||||||
programs.eww = {
|
programs.eww = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
(defwindow mainbar :monitor 0
|
(defwindow mainbar :monitor 0
|
||||||
|
|
||||||
:geometry (geometry :x "0%"
|
:geometry (geometry :x "0%"
|
||||||
:y "0%"
|
:y "0%"
|
||||||
:width "100%"
|
:width "100%"
|
||||||
|
|
@ -39,14 +40,15 @@
|
||||||
`cat /sys/class/power_supply/_BAT_PATH_/capacity`)
|
`cat /sys/class/power_supply/_BAT_PATH_/capacity`)
|
||||||
(defpoll pbat_status :interval "1s" :run-while bat-enabled
|
(defpoll pbat_status :interval "1s" :run-while bat-enabled
|
||||||
`cat /sys/class/power_supply/_BAT_PATH_/status`)
|
`cat /sys/class/power_supply/_BAT_PATH_/status`)
|
||||||
(defpoll network_strength :interval "1s" :run-while wifi-enabled
|
(defpoll wifi_ssid :interval "1s" :run-while wifi-enabled
|
||||||
`nmcli -f IN-USE,SIGNAL device wifi | grep '*' | tr -d -c 0-9`)
|
`iwctl station wlan0 show | grep "Connected network" | awk '{print $3}'`)
|
||||||
|
(defpoll wifi_strength :interval "1s" :run-while wifi-enabled
|
||||||
|
`iw dev wlan0 link | awk '/signal/ {gsub("-",""); print $2}'`)
|
||||||
(defpoll bluetooth_device :interval "1s" :run-while bt-enabled
|
(defpoll bluetooth_device :interval "1s" :run-while bt-enabled
|
||||||
`bluetoothctl devices Connected | grep Device | cut -d" " -f3-`)
|
`bluetoothctl devices Connected | grep Device | cut -d" " -f3-`)
|
||||||
(defpoll bluetooth_device_count :interval "1s" :run-while bt-enabled
|
(defpoll bluetooth_device_count :interval "1s" :run-while bt-enabled
|
||||||
`bluetoothctl devices Connected | wc -l`)
|
`bluetoothctl devices Connected | wc -l`)
|
||||||
|
|
||||||
(deflisten lnetwork :initial "" :run-while wifi-enabled "./scripts/network.sh")
|
|
||||||
(deflisten ltitle :initial "" "./scripts/title.sh")
|
(deflisten ltitle :initial "" "./scripts/title.sh")
|
||||||
(deflisten lworkspaces :initial "[]" "./scripts/workspaces.sh")
|
(deflisten lworkspaces :initial "[]" "./scripts/workspaces.sh")
|
||||||
(deflisten lcurrent_workspace :initial "1" "./scripts/active-workspace.sh")
|
(deflisten lcurrent_workspace :initial "1" "./scripts/active-workspace.sh")
|
||||||
|
|
@ -107,22 +109,22 @@
|
||||||
(defwidget network []
|
(defwidget network []
|
||||||
(button :onclick `eww update network-extended=${network-extended ? "false" : "true"}`
|
(button :onclick `eww update network-extended=${network-extended ? "false" : "true"}`
|
||||||
(box :orientation "horizontal"
|
(box :orientation "horizontal"
|
||||||
:class {"widget pill" + ((network-extended && lnetwork != "Disconnected") ? " extended" : "")}
|
:class {"widget pill" + ((network-extended && wifi_ssid != "") ? " extended" : "")}
|
||||||
:spacing {(network-extended && lnetwork != "Disconnected") ? 5 : 0}
|
:spacing {(network-extended && wifi_ssid != "") ? 5 : 0}
|
||||||
:space-evenly false
|
:space-evenly false
|
||||||
(label :text {
|
(label :text {
|
||||||
(lnetwork == "Disconnected") ? ""
|
(wifi_ssid == "") ? ""
|
||||||
: (network_strength == "") ? ""
|
: (wifi_strength == "") ? ""
|
||||||
: (network_strength < 20) ? ""
|
: (wifi_strength < 75) ? ""
|
||||||
: (network_strength < 30) ? ""
|
: (wifi_strength < 65) ? ""
|
||||||
: (network_strength < 55) ? ""
|
: (wifi_strength < 60) ? ""
|
||||||
: (network_strength < 80) ? ""
|
: (wifi_strength < 50) ? ""
|
||||||
: ""}
|
: ""}
|
||||||
:class "base pill-icon")
|
:class "base pill-icon")
|
||||||
(revealer :transition "slideleft"
|
(revealer :transition "slideleft"
|
||||||
:reveal {network-extended && lnetwork != "Disconnected"}
|
:reveal {network-extended && wifi_ssid != ""}
|
||||||
:duration 150
|
:duration 150
|
||||||
(label :text lnetwork
|
(label :text wifi_ssid
|
||||||
:class "base")))))
|
:class "base")))))
|
||||||
|
|
||||||
(defwidget battery []
|
(defwidget battery []
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
init=$(nmcli -t -f name,device connection show --active | grep wlp1s0 | cut -d\: -f1)
|
|
||||||
|
|
||||||
if [[ -z $init ]]; then
|
|
||||||
echo Disconnected
|
|
||||||
else
|
|
||||||
echo $init
|
|
||||||
fi
|
|
||||||
|
|
||||||
nmcli monitor | while read -r line ; do
|
|
||||||
if [[ $line == *"is now the primary connection" ]]; then
|
|
||||||
conn=$(echo $line | cut -d\' -f2)
|
|
||||||
echo $conn
|
|
||||||
fi
|
|
||||||
if [[ $line == "There's no primary connection" ]]; then
|
|
||||||
echo Disconnected
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue