Omahub
← All plugins
T

Mouse Battery Indicator

by twoscott

Wireless mouse battery glyph with a detail panel

Security review

No obvious issues detected

Deterministic scan — not a security guarantee

None
Risk level
None
Analyzed commit
e9975cf
Scanned
1 month ago

No potentially dangerous behavior detected in the analyzed commit.

Automated analysis only — not a security guarantee.

AI advisory review

No obvious issues detected

Language-model assessment · ~deepseek/deepseek-v4-flash-latest — advisory only

Low
AI risk level
Low
Recommendation
install
Model
~deepseek/deepseek-v4-flash-latest
Analyzed commit
e9975cf
Reviewed
1 month ago

The plugin reads UPower battery information and runs a bash script to fetch extra device details and history. The bash command is static and passes arguments safely as separate argv entries, so there is no command injection. The only dynamic parts are the device's native path and serial, which are system-provided and used in a glob pattern that is quoted, limiting risk to reading unintended files in /var/lib/upower. The code also uses PlainText to prevent rich-text injection. No malicious behavior or hidden persistence was found.

  • The bash script uses a glob pattern with the device serial, which could potentially match unintended files if the serial contains wildcard characters, but this is limited to /var/lib/upower and not a direct security threat.
  • The plugin relies on external commands (upower, sed, cat) which are standard system utilities and not inherently dangerous.
How this check works

This review combines the deterministic scan (the rule-based results above) with an independent look at the plugin's code by a language model. The model reads a trimmed sample of the repository's files, the manifest, and the README, then gives a plain-language risk level and a recommendation: install (no notable danger), review (look closer first), or avoid (clearly dangerous).

It runs on the same analyzed commit as the deterministic scan and is strictly advisory — it is not a security guarantee and never blocks a plugin by itself. A human moderator still reviews plugins before they are listed.

AI advisory only — automated analysis, not a security guarantee.

Install
$ omarchy plugin add https://github.com/twoscott/omarchy-mouse-battery --enable
Widgets #bar #power-management #system

🔋 Omarchy Mouse Battery Widget

This is a wireless mouse battery indicator for the Omarchy bar. The bar shows a battery glyph whose fill is the approximate level; clicking it opens a panel with the exact percentage, charge state, when the mouse last reported, and an estimate of the time remaining.

Battery indicator preview

🖱️ Will it work with your mouse?

This widget shows what UPower already knows — it doesn't talk to your mouse directly. Check before installing:

upower -e                    # list devices
upower -i <one of those paths>

If your mouse isn't listed, or is listed without a percentage, no bar widget can help: the battery level isn't reaching your system at all.

Mouse Works
Logitech wireless — Unifying, Bolt, Lightspeed ✅
Bluetooth mice that expose a battery level ✅
Anything else your kernel exposes as a power supply ✅
Razer, Corsair, SteelSeries & co. on their own 2.4 GHz dongles ❌

That last row is the common disappointment. Those mice report battery over a vendor protocol only their own software understands (OpenRazer, ckb-next, rivalcfg), and none of it reaches UPower. The same mouse connected over Bluetooth often does work — worth trying.

💽 Install

omarchy plugin add https://github.com/twoscott/omarchy-mouse-battery.git --enable
omarchy restart shell

Add it to a bar section in ~/.config/omarchy/shell.json:

{ "id": "io.github.twoscott.mouse-battery" }

🔨 Using it

Input Effect
left click open/close the panel
right click show/hide the percentage next to the bar glyph
middle click refresh the panel now

At or below the low threshold (20% by default, while discharging) the glyph and the panel's reading turn your theme's urgent colour.

When the mouse is switched off it disappears from the system entirely, so the widget hides itself. Set hideWhenAbsent: false to keep a dimmed slot instead.

⚙️ Settings

Key Default What it does
match "" Pick a specific device — see below. Empty means auto-detect.
lowThreshold 20 Percentage at which the reading turns urgent.
showPercentage false Show the percentage on the bar, not just in the panel.
hideWhenAbsent true Hide the widget when the mouse is off.

You can add the widget more than once. A second entry with its own match gives your keyboard — or a second mouse — its own pill:

{ "id": "io.github.twoscott.mouse-battery", "match": "mx keys" }

Panel controls are also available over IPC: omarchy-shell io.github.twoscott.mouse-battery <open|close|toggle|togglePercentage>.

🗑️ Remove

omarchy plugin remove io.github.twoscott.mouse-battery

Picking the right device

Left alone, the widget finds your mouse by itself: it looks at how the system classifies each wireless device, at how the device connects, and at its model name (it knows the common Logitech, Razer, SteelSeries, Corsair and Glorious mouse lines). Devices that are clearly something else — keyboards, headsets, game controllers, your laptop's own battery — are left alone, and if two devices tie, the choice is stable rather than dependent on connection order.

That guessing is not perfect, because not every system reports a mouse as a mouse. If nothing shows up, or the wrong device does, name it yourself with match — a case-insensitive fragment of the model name or device path from upower -i:

{ "id": "io.github.twoscott.mouse-battery", "match": "mx master" }

match overrides the guesswork completely, which is exactly what an unrecognised mouse needs.

Not sure whether it's a matching problem or a hardware one? Set hideWhenAbsent: false — a dimmed slot means "no device matched", nothing at all means the widget isn't loaded.

About the panel's readings

Reported is how long ago the mouse last sent a level. It matters more than you'd think for a wireless device: a mouse asleep in a bag keeps showing its last known level indefinitely, and this row tells you how stale that is.

Time left / Time to full is measured when your mouse provides it. Most mice don't — they report a percentage and nothing else — so the widget works it out from the level history the system keeps for the device, and marks it with a ~. It's shown only when there's enough recent data to justify it, so expect a dash for the first while after a state change, and sometimes for good: some mice don't report at all while charging, and some systems keep their history logs private.

Everything else in the panel works regardless.