Compare commits

..

4 Commits

5 changed files with 81 additions and 12 deletions

58
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: Build and Publish Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
paths-ignore:
- "**.md"
- .github/workflows/build-and-release.yml
- .gitignore
- LICENSE
- img/**
jobs:
build-and-publish:
name: Build and Publish Release
permissions:
contents: write
runs-on: windows-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4.1.0
- name: Setup workflow cache
uses: actions/cache@v4.1.0
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: windows-cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-pc-windows-msvc
- name: Build
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Upload workflow artifact
uses: actions/upload-artifact@v4.1.0
with:
name: razer-battery-report
path: ./target/x86_64-pc-windows-msvc/release/razer-battery-report.exe
if-no-files-found: error
- name: Publish Release
uses: softprops/action-gh-release@v2.1.0
with:
files: ./target/x86_64-pc-windows-msvc/release/razer-battery-report.exe
draft: true
fail_on_unmatched_files: true

4
Cargo.lock generated
View File

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "adler"
@ -1813,7 +1813,7 @@ dependencies = [
[[package]]
name = "razer-battery-report"
version = "0.2.3"
version = "0.2.4"
dependencies = [
"hidapi",
"image",

View File

@ -1,6 +1,6 @@
[package]
name = "razer-battery-report"
version = "0.2.3"
version = "0.2.4"
authors = ["xzeldon <contact@zeldon.ru>"]
edition = "2021"
description = "Razer Battery Level Tray Indicator"

View File

@ -10,15 +10,17 @@
Show your wireless Razer devices battery levels in your system tray.
> This is a work in progress and currently support only **Razer DeathAdder V3 Pro**.
> This is a work in progress and currently support only **Razer DeathAdder V3 Pro** and **Razer DeathAdder V3 HyperSpeed**.
> Currently, this works only on **Windows**, should work on **Linux** if you _add udev rule to get access to usb devices_ (see [here](https://github.com/libusb/hidapi/blob/master/udev/69-hid.rules)) and remove/`cfg(windows)` some platform-specific code. But I haven't tested yet.
> Currently, this works only on **Windows**.
## Usage
### Downloading a Prebuilt Binary
### Installation
> _Todo_
1. Download `razer-battery-report.exe` from [latest release](https://github.com/xzeldon/razer-battery-report/releases/latest)
2. Run `razer-battery-report.exe`
3. If you want a start menu shortcut you can make one yourself! Simply right-click `razer-battery-report.exe` and select "Pin to Start". This will automatically create a shortcut in %appdata%\Microsoft\Windows\Start Menu\Programs.
### Building from Source
@ -44,7 +46,7 @@ To build, you must have [Rust](https://www.rust-lang.org/) and
- [ ] Colored tray icons for different battery levels
- [x] Show log window button in tray menu
- [x] Further reduce CPU usage by using Event Loop Proxy events (more info [here](https://github.com/tauri-apps/tray-icon/issues/83#issuecomment-1697773065))
- [ ] Prebuilt Binary
- [x] Prebuilt Binary
- [ ] Command Line Arguments for update frequency
- [ ] Support for other Razer Devices (I only have DeathAdder V3 Pro, so I won't be able to test it with other devices)

View File

@ -28,7 +28,9 @@ impl DeviceInfo {
pub const fn transaction_id(&self) -> u8 {
match self.pid {
pid if pid == RAZER_DEATHADDER_V3_PRO_WIRED.pid
|| pid == RAZER_DEATHADDER_V3_PRO_WIRELESS.pid =>
|| pid == RAZER_DEATHADDER_V3_PRO_WIRELESS.pid
|| pid == RAZER_DEATHADDER_V3_HYPERSPEED_WIRED.pid
|| pid == RAZER_DEATHADDER_V3_HYPERSPEED_WIRELESS.pid =>
{
0x1F
}
@ -38,11 +40,18 @@ impl DeviceInfo {
}
pub const RAZER_DEATHADDER_V3_PRO_WIRED: DeviceInfo =
DeviceInfo::new("Razer DeathAdder V3 Pro", 0x00B6, 0, 1, 2);
DeviceInfo::new("Razer DeathAdder V3 Pro (Wired)", 0x00B6, 0, 1, 2);
pub const RAZER_DEATHADDER_V3_PRO_WIRELESS: DeviceInfo =
DeviceInfo::new("Razer DeathAdder V3 Pro", 0x00B7, 0, 1, 2);
DeviceInfo::new("Razer DeathAdder V3 Pro (Wireless)", 0x00B7, 0, 1, 2);
pub const RAZER_DEVICE_LIST: [DeviceInfo; 2] = [
pub const RAZER_DEATHADDER_V3_HYPERSPEED_WIRED: DeviceInfo =
DeviceInfo::new("Razer DeathAdder V3 HyperSpeed (Wired)", 0x00C4, 0, 1, 2);
pub const RAZER_DEATHADDER_V3_HYPERSPEED_WIRELESS: DeviceInfo =
DeviceInfo::new("Razer DeathAdder V3 HyperSpeed (Wireless)", 0x00C5, 0, 1, 2);
pub const RAZER_DEVICE_LIST: [DeviceInfo; 4] = [
RAZER_DEATHADDER_V3_PRO_WIRED,
RAZER_DEATHADDER_V3_PRO_WIRELESS,
RAZER_DEATHADDER_V3_HYPERSPEED_WIRED,
RAZER_DEATHADDER_V3_HYPERSPEED_WIRELESS,
];