# Easy way to make the trackball click be a left mouse button

**URL:** <https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116>\
**Category:** uConsole\
**Created:** [September 30, 2023, 3:58am UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116 "2023-09-30T03:58:55Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Segel](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/daniel_segel/32/8116_2.png) [@Daniel\_Segel](https://forum.clockworkpi.com/u/Daniel_Segel)\
**Post date:** [September 30, 2023, 3:58am UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/1 "2023-09-30T03:58:56Z")

</div>

It seems odd that it’s a middle button. I’m always trying to use it to click in menus and other places.

This works on the CM4 at least, not sure about the other options.

Anyway:

````auto
🙂 dsegel@uconsole:~ % xinput list 
⎡ Virtual core pointer id=2	[master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4	[slave pointer (2)]
⎜ ↳ ClockworkPI uConsole Consumer Control id=7	[slave pointer (2)]
⎜ ↳ ClockworkPI uConsole Mouse id=9	[slave pointer (2)]
⎜ ↳ vc4 id=10	[slave pointer (2)]
⎜ ↳ vc4 id=11	[slave pointer (2)]
⎣ Virtual core keyboard id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard id=5	[slave keyboard (3)]
    ↳ axp20x-pek id=6	[slave keyboard (3)]
    ↳ ClockworkPI uConsole Keyboard id=8	[slave keyboard (3)]
    ↳ ClockworkPI uConsole Consumer Control id=12	[slave keyboard (3)]
    ↳ vc4 id=13	[slave keyboard (3)]
    ↳ vc4 id=14	[slave keyboard (3)]```

````

Get the name for the trackball. In this case, it’s “ClockworkPI uConsole Mouse”.

```auto
🙂 dsegel@uconsole:~ % xinput get-button-map "ClockworkPI uConsole Mouse" 1 2 3 4 5 6 7 8 9 10 11 12 

```

The second number, 2, is the middle button on a mouse.

```auto
🙂 dsegel@uconsole:~ % xinput set-button-map "ClockworkPI uConsole Mouse" 1 1 3 4 5 6 7 8 9 10 11 12

```

Now it’s a left button.

Make it automatic by putting into your user cron:

```auto
🙂 dsegel@uconsole:~ % crontab -e 

```

Add this line to your cron:

```auto
@reboot /usr/bin/xinput set-button-map "ClockworkPI uConsole Mouse" 1 1 3 4 5 6 7 8 9 10 11 12

```

Now it’ll run on every boot.

---

<div class="post-metadata">

**Author:** ![garyd](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@garyd](https://forum.clockworkpi.com/u/garyd)\
**Post date:** [October 1, 2023, 7:27pm UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/2 "2023-10-01T19:27:17Z")

</div>

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](https://www.makeuseof.com/rebind-middle-mouse-click-ubuntu) tool:

---

<div class="post-metadata">

**Author:** ![Petrakis](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/petrakis/32/256_2.png) [@Petrakis](https://forum.clockworkpi.com/u/Petrakis)\
**Post date:** [October 1, 2023, 9:36pm UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/3 "2023-10-01T21:36:54Z")

</div>

You can actually change it on source. Download Arduino IDE and the keypad code, compile it and flash it.

> <https://github.com/clockworkpi/uConsole/tree/master/Code/uconsole_keyboard>
>
> //github.com/clockworkpi/uConsole/tree/master/Code/uconsole\_keyboard

---

<div class="post-metadata">

**Author:** ![Daniel\_Segel](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/daniel_segel/32/8116_2.png) [@Daniel\_Segel](https://forum.clockworkpi.com/u/Daniel_Segel)\
**Post date:** [October 2, 2023, 4:44pm UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/4 "2023-10-02T16:44:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Daniel\_Segel](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/daniel_segel/32/8116_2.png) [@Daniel\_Segel](https://forum.clockworkpi.com/u/Daniel_Segel)\
**Post date:** [October 2, 2023, 4:48pm UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/5 "2023-10-02T16:48:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sgsmith](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/sgsmith/32/4595_2.png) [@sgsmith](https://forum.clockworkpi.com/u/sgsmith)\
**Post date:** [October 3, 2023, 3:30am UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/6 "2023-10-03T03:30:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Daniel\_Segel](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/daniel_segel/32/8116_2.png) [@Daniel\_Segel](https://forum.clockworkpi.com/u/Daniel_Segel)\
**Post date:** [October 4, 2023, 1:52am UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/7 "2023-10-04T01:52:30Z")

</div>

Sure, there are two changes.

1. 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.

1. In keymaps.ino:  
OLD:

```auto
 case _TRACKBALL_BTN:
   dv->Mouse->release(MOUSE_MIDDLE);
   break;

```

NEW:

```auto
 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](https://github.com/clockworkpi/uConsole/blob/master/Bin/uconsole_keyboard_flash.tar.gz)) with it. This is all using the code found under Code-\>uConsole Keyboard in the github repo.

---

<div class="post-metadata">

**Author:** ![sgsmith](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/sgsmith/32/4595_2.png) [@sgsmith](https://forum.clockworkpi.com/u/sgsmith)\
**Post date:** [October 4, 2023, 2:45am UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/8 "2023-10-04T02:45:20Z")

</div>

Awesome! Thanks so much for the info! So often I keep using that ball to left click, and the fn scroll is a great idea.

Thanks again!

---

<div class="post-metadata">

**Author:** ![Mykhailo\_Chuha](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/mykhailo_chuha/32/8423_2.png) [@Mykhailo\_Chuha](https://forum.clockworkpi.com/u/Mykhailo_Chuha)\
**Post date:** [February 9, 2024, 3:34am UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/9 "2024-02-09T03:34:45Z")

</div>

Hi! could you share please your pre-build FW? was unable to build it by myself( wanna make my trackball click as left mouse

---

<div class="post-metadata">

**Author:** ![Daniel\_Segel](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/daniel_segel/32/8116_2.png) [@Daniel\_Segel](https://forum.clockworkpi.com/u/Daniel_Segel)\
**Post date:** [February 10, 2024, 4:07pm UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/10 "2024-02-10T16:07:16Z")

</div>

I think it’s this:

> <https://github.com/dsegel/uConsole/tree/master/Code/uconsole_keyboard#:~:text=7%20months%20ago-,uconsole_keyboard.ino.generic_stm32f103r8.bin,-updated%20trackball.ino>
>
> //github.com/dsegel/uConsole/tree/master/Code/uconsole\_keyboard

Try that and if it doesn’t work how you want, let me know.

---

<div class="post-metadata">

**Author:** ![Mykhailo\_Chuha](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/mykhailo_chuha/32/8423_2.png) [@Mykhailo\_Chuha](https://forum.clockworkpi.com/u/Mykhailo_Chuha)\
**Post date:** [February 11, 2024, 6:08am UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/11 "2024-02-11T06:08:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Toml\_12953](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/toml_12953/32/11925_2.png) [@Toml\_12953](https://forum.clockworkpi.com/u/Toml_12953)\
**Post date:** [September 12, 2025, 11:54pm UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/12 "2025-09-12T23:54:12Z")

</div>

I’m using Bookworm 6.12.45 on an RP5. When I do xinput list

I get

```auto
Virtual core pointer     
    Virtual core XTEST pointer
    xwayland-pointer:15 
    xwayland-relative-pointer:15 
    xwayland-pointer-gestures 
Virtual core keyboard 
    Virtual core XTEST keyboard 
    xwayland-keyboard:15

```

Only the pointer and relative pointer have buttons associated with them. I tried changing both from 2 to 1 in the second position but no dice. Any thoughts?

---

<div class="post-metadata">

**Author:** ![white-round-square](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/white-round-square/32/10385_2.png) [@white-round-square](https://forum.clockworkpi.com/u/white-round-square)\
**Post date:** [September 13, 2025, 12:12am UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/13 "2025-09-13T00:12:24Z")

</div>

> [@Toml\_12953](#):
>
> I’m using Bookwork 6.12.45 on an RP5. When I do xinput list

easy mouse button remapping works in X11, but you are using wayland.

in wayland buttons remapping should handle your windows manager so it may not work.

1. so the easiest way is to switch back to X11 via `sudo raspi-config`

2. for wayland check `libinput` related tools _(if your DM is using `libinput` (most probably))_:

> **[libinput - ArchWiki](https://wiki.archlinux.org/title/Libinput#Configuration)**

> **[Wayland+libinput: remap mouse buttons](https://discourse.nixos.org/t/wayland-libinput-remap-mouse-buttons/54659)**
>
> My Logitech M510 has its side buttons swapped (probably 4 and 5, I’m used to the one closer to wrist being “Browser Forward” and the other one “Browser Back”, but on M510 they are reversed). How can I configure my system to remap them the way I...

> **[Input remap utilities - ArchWiki](https://wiki.archlinux.org/title/Input_remap_utilities)**

_(3. as an alternative hardware solution you can tune QMK firmware, compile it and flash into keyboard)_

---

<div class="post-metadata">

**Author:** ![kultakala](https://avatars.discourse-cdn.com/v4/letter/k/439d5e/32.png) [@kultakala](https://forum.clockworkpi.com/u/kultakala)\
**Post date:** [November 25, 2025, 12:35pm UTC](https://forum.clockworkpi.com/t/easy-way-to-make-the-trackball-click-be-a-left-mouse-button/11116/14 "2025-11-25T12:35:43Z")

</div>

Hi, I am running a Trixie image on my uConsole.

Can i do the changes to the trackball settings somehow within my image ?

Without installing the altered image ?
