This is a script for Windows written in Python 3.10+ with wxPython
and pyusb
that gets the battery level of a Razer Wireless mouse (Razer Viper V2 Pro by default) and shows it in system tray.
- Clone this repository.
- Go to the website of
libusb
to download the Latest Windows Binaries. - Extract
\VS2019\MS64\dll\libusb-1.0.dll
and place it next to script file. - Install dependencies:
pip install -r requirements.txt
- By default script is set up to work with Razer Viper V2 Pro. If you want to use it with different Razer mouse, see next chapter.
Warning: TRY AT YOUR OWN RISK!
To adapt the script for your Razer mouse, follow the steps below:
- Get the
PIDs
of your mouse in both the wireless and wired mode:
You can find VID:PID pairs here, or you can find it by yourself:
Go to Device Manager -> Find your mouse -> Right click -> Properties -> Details -> Hardware Ids -> Repeat in the other state
- e.g. for Razer Viper V2 Pro, in wireless state, the entries of Hardware Ids contain
VID_1532&PID_00A6
, then 0x00A6 is the PID in the wireless state - In wired state, the entries contain
VID_1532&PID_00A5
, then 0x00A5 is the PID in the wired state
- Get
transaction_id.id
for your mouse from here - If the name of your mouse appears inside the switch statement, write down the
transaction_id.id
- e.g., I see
USB_DEVICE_ID_RAZER_VIPER_V2_PRO_WIRELESS
inside the switch statement, so thetransaction_id.id
for my mouse is0x1f
- If you do not see your mouse name inside, then the
transaction_id.id
is0xff
- Modify these lines of the script:
MODEL = "Razer Viper V2 Pro" # your mouse name
WIRELESS_RECEIVER = 0x00A6 # PID in wireless mode
WIRELESS_WIRED = 0x00A5 # PID in wired mode
TRAN_ID = b"\x1f" # transaction_id.id for your mouse
- Done!
You can modify these settings variables:
poll_rate
in seconds - how often battery charge is read. 30 sec by default.foreground_color
- color of indicator text. Tuple with RGB data.backgroung_color
- color of indicator background. Transparent by default (0, 0, 0, 0).font
- indicator font.
Based on this work: https://github.com/hsutungyu/razer-mouse-battery-windows
Quote from hsutungyu:
This script is written by looking into OpenRazer, a GNU/Linux driver for controlling razer devices.
Also, I have referenced the blog post and the script by Roland Smith in the process of writing this script.