This commit is contained in:
ION606
2026-01-03 12:55:26 -08:00
parent 60610dc81d
commit 1fc598c6a0
6 changed files with 141 additions and 13 deletions
+5 -4
View File
@@ -64,13 +64,14 @@ fmt_time() {
hours="${hours% hour}";
# convert decimal hours to h m
local total_min;
total_min="$(python - <<'PY'
total_min="$(python - <<'PY' "$hours"
import math,sys
h=float(sys.stdin.read().strip())
m=round((h-int(h))*60)
arg = sys.argv[1] if len(sys.argv) > 1 else "0"
h = float(arg)
m = round((h - int(h)) * 60)
print(f"{int(h)}h{m}m")
PY
<<<"$hours")";
)";
printf "%s" "$total_min";
else
printf "%s" "$raw";
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# check status of a specific bluetooth device via bluetoothctl
# check if bluetooth service is active
if ! systemctl is-active --quiet bluetooth.service; then
echo "Bluetooth off" # icon or text when BT is down
exit 0
fi
# check if controller is powered on
if ! bluetoothctl show | grep -q "Powered: yes"; then
echo "BT ctrl off"
exit 0
fi
# check connected status
mapfile -t macs < <(bluetoothctl devices | awk '{print $2}')
connected_name=""
for mac in "${macs[@]}"; do
# get info for this device
info=$(bluetoothctl info "$mac")
if echo "$info" | grep -q "Connected: yes"; then
# extract Name:
name=$(echo "$info" | grep "^\\s*Name:" | sed 's/.*Name: //')
connected_name="$name"
break
fi
done
if [[ -n "$connected_name" ]]; then
# you can replace the icon with a nerd-font icon if you use one
echo "$connected_name"
else
echo " Disconnected"
fi
+7 -9
View File
@@ -11,11 +11,13 @@ modules-left = i3
modules-center = memory
modules-right = cpu player wifi bluetooth clock backlight battery
font-0 = Noto Sans:size=10;2
font-1 = Font Awesome 6 Free Solid:size=10;2
# font-1 = Font Awesome 6 Free Solid:size=10;2
font-1 = "Symbols Nerd Font:size=12;2"
font-2 = Font Awesome 6 Brands:size=10;2
font-3 = DejaVu Sans Mono:size=10;2
font-4 = Nerd Font:style=Regular:size=12;0
font-5 = NotoEmoji:scale=10;
font-6 = ttf-arimo-nerd:scale=10
separator = |
separator-foreground = #6a0dad
@@ -149,15 +151,11 @@ animation-packetloss-1 = 📶
animation-packetloss-1-foreground = #000000
animation-packetloss-framerate = 500
[module/bluetooth]
type = internal/bluetooth
interval = 5
format-connected =  %name%
format-disconnected =  Off
format-foreground = #ffffff
format-background = #483d8b
format-padding = 5
type = custom/script
exec = /home/ion606/.config/polybar/scripts/bluetooth_status.sh
interval = 1
click-left = blueman-manager &
[module/player]