Add mouse battery pill, disable pointer acceleration

Setting up OpenRazer (for the battery read) reset the mouse's DPI to
its 1800 default, exposing that input.accel_profile was never set -
Hyprland/libinput default to an adaptive (accelerated) curve, which
became noticeable once the DPI changed. accel_profile = "flat" for a
linear 1:1 response, which is what was expected all along.

New mouse battery pill in the bar (between network and clock), via
scripts/mouse_battery.py querying openrazer - hidden entirely if no
Razer device is found, so it's a no-op for anyone without one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94
This commit is contained in:
nico
2026-10-03 16:13:47 +02:00
parent 0c4a1307a9
commit 3b4e649dc8
3 changed files with 84 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env python3
"""Prints the Razer mouse's battery as JSON: {"available": bool, "pct": int,
"charging": bool, "name": str}. "available" is false (nothing else meaningful in the
object) if openrazer isn't installed, its daemon isn't reachable, or no device is
connected - deliberately never raises, since a traceback on stdout would break the
bar's JSON.parse of this output.
"""
import json
try:
from openrazer.client import DeviceManager
devices = DeviceManager().devices
if not devices:
raise RuntimeError("no device")
d = devices[0]
print(json.dumps({"available": True, "pct": d.battery_level,
"charging": d.is_charging, "name": d.name}))
except Exception:
print(json.dumps({"available": False}))