z3ntu / RazerGenie

Qt application for configuring your Razer devices under GNU/Linux.
GNU General Public License v3.0
374 stars 35 forks source link

BlackWidow V3 Pro Layout Editor Incorrect/Does Not Exist #149

Open arrowj opened 1 year ago

arrowj commented 1 year ago

Fedora 37 RazerGenie 1.0.0 (Fedora Flathub Selection Flatpak) sudo dnf install razergenie OpenRazer Daemon 3.5.1

My keyboard does not seem to be fully supported by OpenRazer yet, but it is recognized when plugged in. If I set a static color for the entire keyboard in Polychromatic or RazerGenie it sticks around when I unplug and switch to dongle or Bluetooth connection.

The keyboard layout presented for assigning per key colors is incorrect. The grid is not wide enough, nor are the keys aligned. I have never created a keyboard layout, but it seems close to trivial, and I was going to give it a shot in case anyone else needed the BlackWidow V3 Pro layout. I have access to the .json files in VS Code both from the repository and /usr/share/razergenie/matrix_layouts/

Can someone tell me if I am missing something about how this works? It does seem like there are not many layouts included by default so maybe I am confused about how this feature is implemented? I'm not a developer, but I do have a better understanding of what computer code is than any developer living today.

Edit: I originally had RazerGenie installed via FlatPak, but have sense installed via the command line in hopes it would make the process easier.

arrowj commented 1 year ago

If I open the matrix view in Polychromatic and map out the BlackWidow V3 Pro keyboard I get what is shown here, but I have no idea if the matrix used in these programs is universal, or what other formatting requirements I am missing. Not to mention typos, etc. But this is a step in the right direction (I think) if anyone is interested. Of course it could be that everyone else with this keyboard pulls up the RazerGenie editor and it shows the correct keyboard layout?

Anyway, a couple things of note: the logo on the bottom of the physical keyboard is mapped to (3, 14) which seems odd. Also, this keyboard has three small round media buttons back, play/pause, and forward and one large volume knob with a mute function when the center is pushed. However these four buttons use five LEDs with the play/pause button using both (0, 18) and (0,19). Not sure why.

blackwidow_v3_matrix.ods blackwidow_v3_pro_matrix

I am not quite clear on the .json formatting yet. Every matrix coordinate that has no led I added a null. The sizing and much of the rest is what was in the default22 .json file. I will mess with this more tomorrow perhaps unless someone tells me I am reinventing the wheel or otherwise wasting my time.

{
    "en_US": {
        "row0": [
            {"label": "esc", "matrix": [0, 0]},
            {"label": null},
            {"label": "F1", "matrix": [0, 2]},
            {"label": "F2", "matrix": [0, 3]},
            {"label": "F3", "matrix": [0, 4]},
            {"label": "F4", "matrix": [0, 5]},
            {"label": "F5", "matrix": [0, 6]},
            {"label": "F6", "matrix": [0, 7]},
            {"label": "F7", "matrix": [0, 8]},
            {"label": "F8", "matrix": [0, 9]},
            {"label": "F9\nMacro", "matrix": [0, 10]},
            {"label": "F10\nGaming", "matrix": [0, 11]},
            {"label": "F11\nLED Up", "matrix": [0, 12]},
            {"label": "F12\nLED Down", "matrix": [0, 13]},
            {"label": "prt sc", "matrix": [0, 14]},
            {"label": "scr\nlk", "matrix": [0, 15]},
            {"label": "pause\nSleep", "matrix": [0, 16]},
            {"label": "Media\nBack", "matrix": [0, 17]},
            {"label": "Media\nPlay/Pause", "matrix": [0, 18]},
            {"label": "Media\nPlay/Pause", "matrix": [0, 19]},
            {"label": "Media\nForward", "matrix": [0, 20]},
            {"label": "Audio\nKnob", "matrix": [0, 21]}
        ],
        "row1": [
            {"label": "`", "matrix": [1, 0]},
            {"label": "1", "matrix": [1, 1]},
            {"label": "2", "matrix": [1, 2]},
            {"label": "3", "matrix": [1, 3]},
            {"label": "4", "matrix": [1, 4]},
            {"label": "5", "matrix": [1, 5]},
            {"label": "6", "matrix": [1, 6]},
            {"label": "7", "matrix": [1, 7]},
            {"label": "8", "matrix": [1, 8]},
            {"label": "9", "matrix": [1, 9]},
            {"label": "0", "matrix": [1, 10]},
            {"label": "-", "matrix": [1, 11]},
            {"label": "=", "matrix": [1, 12]},
            {"label": "backspace", "width": 126, "matrix": [1, 13]},
            {"label": "ins", "matrix": [1, 14]},
            {"label": "home", "matrix": [1, 15]},
            {"label": "pg\nup", "matrix": [1, 16]},
            {"label": "num", "matrix": [1, 17]},
            {"label": "/", "matrix": [1, 18]},
            {"label": "*", "matrix": [1, 19]},
            {"label": "-", "matrix": [1, 20]}
            {"label": null}
        ],
        "row2": [
            {"label": "tab", "width": 94, "matrix": [2, 0]},
            {"label": "Q", "matrix": [2, 1]},
            {"label": "W", "matrix": [2, 2]},
            {"label": "E", "matrix": [2, 3]},
            {"label": "R", "matrix": [2, 4]},
            {"label": "T", "matrix": [2, 5]},
            {"label": "Y", "matrix": [2, 6]},
            {"label": "U", "matrix": [2, 7]},
            {"label": "I", "matrix": [2, 8]},
            {"label": "O", "matrix": [2, 9]},
            {"label": "P", "matrix": [2, 10]},
            {"label": "[", "matrix": [2, 11]},
            {"label": "]", "matrix": [2, 12]},
            {"label": "\\", "width": 92, "matrix": [2, 13]},
            {"label": "del", "matrix": [2, 14]},
            {"label": "end", "matrix": [2, 15]},
            {"label": "pg\ndn", "matrix": [2, 16]},
            {"label": "7", "matrix": [2, 17]},
            {"label": "8", "matrix": [2, 18]},
            {"label": "9", "matrix": [2, 19]},
            {"label": "+", "matrix": [2, 20]},
            {"label": null}
        ],
        "row3": [
            {"label": "caps", "width": 109, "matrix": [3, 0]},
            {"label": "A", "matrix": [3, 1]},
            {"label": "S", "matrix": [3, 2]},
            {"label": "D", "matrix": [3, 3]},
            {"label": "F", "matrix": [3, 4]},
            {"label": "G", "matrix": [3, 5]},
            {"label": "H", "matrix": [3, 6]},
            {"label": "J", "matrix": [3, 7]},
            {"label": "K", "matrix": [3, 8]},
            {"label": "L", "matrix": [3, 9]},
            {"label": ";", "matrix": [3, 10]},
            {"label": "'", "matrix": [3, 11]},
            {"label": null},
            {"label": "enter", "width": 143, "matrix": [3, 13]},
            {"label": "[logo]", "matrix": [0, 20], "width": 60},
            {"label": null},
            {"label": null},
            {"label": "4", "matrix": [3, 17]},
            {"label": "5", "matrix": [3, 18]},
            {"label": "6", "matrix": [3, 19]},
            {"label": null},
            {"label": null}        
        ],
        "row4": [
            {"label": "shift", "width": 146, "matrix": [4, 0]},
            {"label": null},
            {"label": "Z", "matrix": [4, 2]},
            {"label": "X", "matrix": [4, 3]},
            {"label": "C", "matrix": [4, 4]},
            {"label": "V", "matrix": [4, 5]},
            {"label": "B", "matrix": [4, 6]},
            {"label": "N", "matrix": [4, 7]},
            {"label": "M", "matrix": [4, 8]},
            {"label": ",", "matrix": [4, 9]},
            {"label": ".", "matrix": [4, 10]},
            {"label": "/", "matrix": [4, 11]},
            {"label": null},
            {"label": "shift", "width": 172, "matrix": [4, 13]},
            {"label": null},
            {"label": "Up\nArrow", "matrix": [4, 15]},
            {"label": null},
            {"label": "1", "matrix": [4, 17]},
            {"label": "2", "matrix": [4, 18]},
            {"label": "3", "matrix": [4, 19]},
            {"label": "enter", "matrix": [4, 20]},
            {"label": null}
        ],
        "row5": [
            {"label": "ctrl", "width": 94, "matrix": [5, 0]},
            {"label": "Windows", "matrix": [5, 1]},
            {"label": "alt", "width": 94, "matrix": [5, 2]},
            {"label": null},
            {"label": null},
            {"label": null},
            {"label": "space", "width": 388, "matrix": [5, 6]},
            {"label": null},
            {"label": null},
            {"label": null},
            {"label": "alt", "width": 94, "matrix": [5, 10]},
            {"label": "fn", "matrix": [5, 11]},
            {"label": "Menu", "matrix": [5, 12]},
            {"label": "ctrl", "width": 92, "matrix": [5, 13]},
            {"label": "Left\nArrow", "matrix": [5, 14]},
            {"label": "Down\nArrow", "matrix": [5, 15]},
            {"label": "Right\nArrow", "matrix": [5, 16]},
            {"label": null},
            {"label": "0\nins", "width": 126, "matrix": [5, 18]},
            {"label": ".\ndel", "matrix": [5, 19]},
            {"label": null},
            {"label": null}
        ]
    }
}
arrowj commented 1 year ago

Replacing the default *22.json matrix file with the above simply produces a x 22 matrix. This can be used to set per key LED for the BlackWidow V3 Pro, but unlike the static effect (and possibly the other "built-in" effects), it does not stick around once the Keyboard is unplugged. In other words, OpenRazer only supports this device via a wired connection. At any rate, I am assuming it would take work in the code to actually render a layout that is visually similar to the BlackWidow V3 Pro, and I am not a programmer. If you want to just use the full matrix you can replace the contents of /usr/share/razergenie/matrix_layouts/razerdefault22.json with the .json above. Frankly, I suspect if you replaced it with anything it would present you with a full matrix, but I am not sure. Polychromatic appears to be a slightly more active project, and can accomplish the same thing, but it is really swings and roundabouts.

z3ntu commented 1 year ago

Yes generally I want to have a correct layout for every device and every keyboard layout. But it seems we will need some extra modifications since now we have a different device with the same matrix dimensions (6x22) but with mismatching layout.

If you get the fallback layout (which btw you can always trigger by holding shift key while opening custom editor) it's possible it fails to parse the json you provided. Best open razergenie from the terminal and check if there are any errors in log when opening the custom editor.

Happy to help with any extra problems. Also if you want me to help more / do the layout just let me know.