mirror of
https://github.com/ION606/config-backup.git
synced 2026-05-14 22:16:58 +00:00
merge
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user