Networkwidget: Add a hack for bluetooth power levels.

This commit is contained in:
Dmitry Voronin 2024-12-26 12:35:26 +03:00
parent 6016b0a3e5
commit 8df54677d0
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
3 changed files with 7 additions and 4 deletions

View file

@ -187,7 +187,7 @@ in
};
"custom/network" = {
exec = "swayscript networkwidget";
# interval = refreshInterval;
# interval = 60;
on-click = "blueman-manager";
on-click-middle = "swayscript network";
on-click-right = "nm-connection-editor";
@ -196,18 +196,22 @@ in
};
"custom/taghw1" = {
exec = "echo ";
interval = "once";
tooltip = false;
};
"custom/taghw2" = {
exec = "echo ";
interval = "once";
tooltip = false;
};
"custom/tagbt1" = {
exec = "test -e /sys/class/power_supply/BAT*/capacity && echo ";
interval = "once";
tooltip = false;
};
"custom/tagbt2" = {
exec = "test -e /sys/class/power_supply/BAT*/capacity && echo ";
interval = "once";
tooltip = false;
};
};

View file

@ -1,3 +1 @@
{ ... }:
{
}
{ ... }: { }

View file

@ -11,6 +11,7 @@ function networkwidget() {
local icon="󰖩"
local class=""
[[ ${#_bts_raw[@]} -gt 0 ]] && sleep 1 # HACK: Darn bluetooth battery levels!
for bt in ${_bts_raw[@]}; do
local name=$(printf "%s" ${bt} | cut -d\ -f3)
local mac=$(printf "%s" ${bt} | cut -d\ -f2 | sed -e "s/:/_/g")