added script to display razer mouse battery
This commit is contained in:
25
.config/waybar/scripts/razer_basilisk_v3_pro_battery_info.sh
Executable file
25
.config/waybar/scripts/razer_basilisk_v3_pro_battery_info.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Path to your Razer HID battery info
|
||||
BASE="/sys/bus/hid/drivers/razermouse/0003:1532:00AB.000A"
|
||||
|
||||
# Read raw level and charging status
|
||||
raw=$(cat "${BASE}/charge_level")
|
||||
status=$(cat "${BASE}/charge_status") # 1=charging, 0=not charging
|
||||
|
||||
# Compute %
|
||||
percent=$(( raw * 100 / 255 ))
|
||||
|
||||
# Choose icon + class
|
||||
if [[ $status -eq 1 ]]; then
|
||||
icon="⚡" # charging icon
|
||||
cls="charging"
|
||||
text="${icon} ${percent}%"
|
||||
else
|
||||
cls="not_charging"
|
||||
text="${percent}%"
|
||||
fi
|
||||
|
||||
# Output Waybar‐friendly JSON
|
||||
printf '{"text":"%s","class":"%s"}\n' "$text" "$cls"
|
||||
|
Reference in New Issue
Block a user