Cool hack! For what it’s worth, a click on a mouse wheel has always defaulted to a third (middle) mouse button in X. In Linux, you can also accomplish this with systemd’s hardware database management tool:
Yeah, I actually did that afterwards, along with making the trackball work as a scroll wheel with the Fn key, but some people may want a simpler approach.
Right, but using it depends on which window manager you’re using, and I didn’t think anybody was still doing that kind of thing.
I tried doing it with various other methods like you posted but it either didn’t work or wasn’t as simple as I would like. I ended up just modifying the firmware anyway, but this is still an easy way to switch it back and forth.
can you share the code changes you made for both left click and scroll with fn?
edit –
I guess _MOUSE_MID, // Mouse.press(2) to become _MOUSE_MID, // Mouse.press(1)
to fix the left click. but then fn to scroll, i’m not that good at reversing code, or writing… i can only do basic deduction
In trackball.ino:
OLD: const auto mode = dv->state->moveTrackball();
NEW: const auto mode = dv->Keyboard_state.fn_on == 0 ? TrackballMode::Mouse : TrackballMode::Wheel;
This is about line 70 in the current version.
In keymaps.ino:
OLD:
case _TRACKBALL_BTN:
dv->Mouse->release(MOUSE_MIDDLE);
break;
NEW:
case _TRACKBALL_BTN:
dv->Mouse->release(MOUSE_LEFT);
break;
This is about line 433 in the current version.
Make both those changes, select Sketch->Export compiled Binary and you should get a .bin file in the same directory as the files. Copy that to the uConsole and run the flash utility (uconsole_keyboard_flash.tar.gz) with it. This is all using the code found under Code->uConsole Keyboard in the github repo.
already did. trackball press there acting as a middle button. I figured out why my build did not flashed. I had to use exact board lib version as listed in sources, not the last one. Updated code and set both press and release events as left button - and now it works