lostallmymoney / Razer_Mouse_Linux

Enables macros with extra razer buttons. Also works with other devices.
Other
42 stars 9 forks source link
corsair key-mapper keypad linux macro macros mice mouse razer razer-drivers razer-macros razer-peripherals

Razer Mouse Linux (Easy macro utility)

..also can accept other devices by adding the files. Contact me to add devices.
Currently supporting X11 AND WAYLAND.(Ubuntu & flavors & anything you can install the dependencies on)
Now with app auto profiles !

INSTALL :

In one command :
sudo apt install unzip wget -y && wget https://codeload.github.com/lostallmymoney/Razer_Mouse_Linux/zip/refs/heads/master -O Razer_Mouse_Linux.zip && unzip -o Razer_Mouse_Linux.zip && cd Razer_Mouse_Linux-master && sh install.sh && cd .. && rm -rf Razer_Mouse_Linux-master Razer_Mouse_Linux.zip
Or run sh install.sh from the directory to install.

SUPPORTS :

Probably works with :

You can also edit src/naga.cpp to adapt the installation to another device, using different inputs and/or different key codes than
the Naga Epic, 2014, Molten or Chroma. For Example, Epic Chroma is compatible with Epic (they have the same buttons),
so you would only have to add an additional line to the devices vector.

AUTORUN :

Now works with systemctl services !
Also adds 2 lines to your .profile and a line to the sudoer's file to make sure you are always able to start the daemon on relogin.

CONFIGURATION :

The configuration file keyMap.txt has the following syntax config=<configName> set the name of the following config. The initial loaded config be defaultConfig unless specified as argument. <keynumber> - <option>=<command> <keynumber> is a number between 1-14 representing the 12 keys of the naga's keypad + two on the top of the naga. <option> determines what will be applied to <command>. The possible choices are:

Use theses to press/unpress any char (faster than xdotool, no support for keys like ctrl or media yet)

<command> is what is going to be used based on the option.
To test any <command> run it in the command cited above.
configEnd Marks the end of a config.
For a mouseclick run xdotool click <command> (Can put numbers from 1 to 9 and options such as *--window etc).
You may have as many configs as you want in the keyMap.txt file, just make sure to give them different names and include defaultConfig.

Link for Keys

NOTES :

To reload the config run the command :
naga start
which will restart the daemon
!!!!!!!!!!!!
If the $HOME/.naga/keyMap.txt file is missing the daemon won't start
(the program will NOT autocreate this file, the install.sh script will copy an example file though).
For a key multiple actions may be defined. They will then be executed sequentially at the key press.
An example keyMap.txt configuration file is the following:

Comments should be accepted

config=defaultConfig
1 - key=XF86AudioPlay
3 - chmap=420configEnemyBlazerWoW
4 - run=notify-send 'Button # 4' 'Pressed'
#etc
configEnd

config=420configEnemyBlazerWoW
1 - run=sh ~/hacks.sh
2 - chmap=defaultConfig
#etc
configEnd     

If you are trying to disable a button's original input, you might want to test with xinput or evtest.
Any non existing functionality can be created through the "run" option.

In depth :

1) In order to get rid of the original bindings it disables the keypad using xinput as follows:
$ xinput set-int-prop [id] "Device Enabled" 8 0
where [id] is the id number of the keypad returned by $ xinput.
2) You may have to also run
$ xinput set-button-map [id2] 1 2 3 4 5 6 7 11 10 8 9 13 14 15
where [id2] is the id number of the pointer device returned by xinput
In the case of naga 2014 you also have to check which of those two has more than 7 numbers by typing xinput get-button-map [id2].
Although this seems to be unnecessary in some systems (i.e CentOS 7)
This tool adds the files $HOME/.naga/, /etc/udev/rules.d/80-naga.rules, /usr/local/bin/(naga && nagaXinputStart.sh), and /etc/systemd/system/naga.service.
It also adds two lines to your ~/.profile for persistance, along with one line to the sudoer's file, which lets you run sudo systemctl start naga from within your .profile.

UNINSTALLATION :

To uninstall run naga uninstall .