Rustazer to zaawansowane narzędzie dla systemu Linux stworzone z myślą o myszy Razer Naga Trinity. Projekt łączy w sobie graficzny interfejs użytkownika (GUI) oraz wysokowydajny podprogram (daemon) napisany w języku Rust, który bezpośrednio monitoruje surowe porty urządzeń (hidraw), obsługuje dynamiczną zmianę paneli bocznych (12, 7 lub 2 przyciski) oraz automatycznie przełącza profile makr w zależności od aktualnie aktywnego okna w systemie.
Aby program działał poprawnie, należy ustawić profil domyślny w systemie Windows. Przypisz klawisz F15 do pochylenia kółka przewijania w lewo, a klawisz F16 do pochylenia w prawo. Podczas przełączania się z systemu Windows na system Linux, należy pozostawić mysz w tym profilu; w przeciwnym razie program nie będzie działał. (Pracuję nad innym rozwiązaniem, ale zajmie to trochę czasu – muszę odtworzyć tę mysz).
Zainstaluj OpenRazer i Polychromatic.
Projekt opiera się na architekturze wielomodułowej:
- Skrypt Startowy (
rustazer.sh) – Główny punkt wejścia. Odpowiada za automatyczne sprawdzenie zależności, skompilowanie projektu w trybie najwyższej wydajności (Release) oraz uruchomienie aplikacji. - Podprogram w tle (
hidraw-harvester) – Nasłuchuje zdarzeń HID z myszy i symuluje naciśnięcia klawiszy/skrótów za pomocąxdotoollubydotool. - Skrypt Zarządzający (
run.sh) – Odpowiada za bezpieczne uruchamianie i czyszczenie stanu (oraz przywracanie domyślnej mapy przycisków X11) przy zamknięciu programu.
Do poprawnego działania programu potrzebne jest środowisko Rust oraz narzędzia symulujące wejście.
W zależności od używanego środowiska graficznego (X11 / Wayland), zainstaluj:
- Ubuntu / Debian / Linux Mint:
sudo apt update sudo apt install xdotool ydotool xinput
Upewnij się, że masz zainstalowany kompilator Rust i menedżer pakietów Cargo:
Oficjalna instrukcja instalacji (rustup)
Konfiguracja Uprawnień (Reguła Udev)
Ponieważ program odczytuje surowe strumienie danych HID z /dev/hidraw*, domyślnie wymaga uprawnień administratora. Aby umożliwić mu działanie bez sudo, skonfiguruj regułę udev:
Wklej następującą linijkę (zezwala na dostęp do urządzeń Razer): Plaintext
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1532", MODE="0666", GROUP="plugdev"
Zapisz plik i przeładuj reguły w systemie:
Bash
sudo udevadm control --reload-rules
sudo udevadm trigger
Instalacja i Uruchomienie
Sklonuj repozytorium do wybranego katalogu:
Bash
cd ~/Dokumenty
git clone [https://github.com/TwojaNazwaUzytkownika/Rustazer.git](https://github.com/TwojaNazwaUzytkownika/Rustazer.git)
cd Rustazer
Nadaj uprawnienia do wykonywania skryptom startowym:
Bash
chmod +x rustazer.sh
chmod +x hidraw-harvester/run.sh
Uruchomienie programu:
Całą aplikację (wraz z automatycznym budowaniem/sprawdzaniem kodu w tle) uruchamia się jednym skryptem:
Bash
./rustazer.sh
Rustazer is an advanced tool for Linux designed for the Razer Naga Trinity mouse. The project combines a Graphical User Interface (GUI) and a high-performance background program (daemon) written in Rust, which directly monitors raw device ports (hidraw), handles dynamic switching of side plates (12, 7, or 2 buttons), and automatically switches macro profiles depending on the currently active window in the system.
For the program to work correctly, you need to set the default profile in Windows. Assign F15 to the scroll wheel's left tilt and F16 to the right tilt. When switching from Windows to Linux, leave the mouse on that profile; otherwise, the program won't work. (I'm working on a different solution, but it will take some time—I need to reverse-engineer this mouse.)
The project is based on a multi-module architecture:
- Startup Script (
rustazer.sh) – The main entry point. It is responsible for automatically checking dependencies, compiling the project in highest-performance mode (Release), and launching the application. - Background Daemon (
hidraw-harvester) – Listens for HID events from the mouse and simulates keystrokes/shortcuts usingxdotoolorydotool. - Management Script (
run.sh) – Responsible for safely starting and cleaning up the state (as well as restoring the default X11 button mapping) upon closing the program.
Proper operation of the program requires the Rust environment and input-simulation tools.
Depending on your display server (X11 / Wayland), install:
- Ubuntu / Debian / Linux Mint:
sudo apt update sudo apt install xdotool ydotool xinput Arch Linux: Bash sudo pacman -S xdotool ydotool xinput
- Rust Environment
Make sure you have the Rust compiler and Cargo package manager installed:
Official installation guide (rustup)
⚙️ Permission Configuration (Udev Rule)
Since the program reads raw HID data streams from /dev/hidraw*, it typically requires administrator privileges. To allow it to run without sudo, configure a udev rule:
Create a rules file in /etc/udev/rules.d/:
Bash
sudo nano /etc/udev/rules.d/99-razer-hidraw.conf
Paste the following line (grants access to Razer devices):
Plaintext
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1532", MODE="0666", GROUP="plugdev"
Save the file and reload rules in the system:
Bash
sudo udevadm control --reload-rules
sudo udevadm trigger
📥 Installation and Running
Clone the repository to your chosen directory:
Bash
cd ~/Documents
git clone [https://github.com/YourUsername/Rustazer.git](https://github.com/YourUsername/Rustazer.git)
cd Rustazer
Grant execution permissions to the startup scripts:
Bash
chmod +x rustazer.sh
chmod +x hidraw-harvester/run.sh
Run the program:
Launch the entire application (along with automatic code building/checking in the background) with a single script:
Bash
./rustazer.sh