Skip to content

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.

License

Fan4Metal/razer_tray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Razer Tray Charge Notification

Introduction

Screenshot

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.

Instruction

  1. Clone this repository.
  2. Go to the website of libusb to download the Latest Windows Binaries.
  3. Extract \VS2019\MS64\dll\libusb-1.0.dll and place it next to script file.
  4. Install dependencies: pip install -r requirements.txt
  5. 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.

How to adapt the script for different Razer mouse

Warning: TRY AT YOUR OWN RISK!
To adapt the script for your Razer mouse, follow the steps below:

  1. 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
  1. Get transaction_id.id for your mouse from here
  2. 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 the transaction_id.id for my mouse is 0x1f
  • If you do not see your mouse name inside, then the transaction_id.id is 0xff
  1. 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
  1. Done!

Settings

You can modify these settings variables:

  1. poll_rate in seconds - how often battery charge is read. 30 sec by default.
  2. foreground_color - color of indicator text. Tuple with RGB data.
  3. backgroung_color - color of indicator background. Transparent by default (0, 0, 0, 0).
  4. font - indicator font.

Credit

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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages