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

View file

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

View file

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