Fix middle mouse button behaviour with Microsoft Intellimouse Pro
https://askubuntu.com/questions/1568111/fix-middle-mouse-button-behaviour-with-microsoft-intellimouse-pro
I just swapped out my Microsoft intellimouse Classic with a Microsoft Intellimouse pro because of an issue with tracking on any surface that isn't white. I'm glad to say that tracking is now working. However, my middle-click to paste behaviour is no longer working, and when I middle click, it now brings up the workspace switcher in KDE. I'm running stock Ubuntu 22.04, but then installed the KDE desktop on top. If I plug in my old mouse, the middle mouse button works as expected.
When I googled for an answer, the Google AI told me to remap the buttons using something like:
xinput set-button-map "Microsoft Microsoft Pro Intellimouse Mouse" 1 9 3 4 5 6 7 8 2
However, I tried swapping 2 with every other number in the list, and nothing worked.
I then ran the following command to get a terminal to tell me which mouse button is down:
watch -n 1 xinput --query-state 11
which gives me output like below:

When i hold down on the left and right buttons I see that button 1 and 3 show as down respectively. However, holding down on the middle mouse button does not show any change, but does bring up a panel that appears on the left hand side, with an image of my desktop at the top that says "Default" as shown below:

I must confess that I don't actually know what this is.
Any help on how to get my middle mouse button working how it should be, with the default copy/paste behaviour that Linux has would be much appreciated. This is such an odd issue to have.
Update - 3rd July 2026
I plugged the mouse into my debian 12 laptop (also running kde) and saw that it was performing the same way, even with the middle mouse button not registering with the querying command earlier. I ran xinput --list to find the device and saw the following:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft Pro Intellimouse Mouse id=10 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft Pro Intellimouse Keyboard id=11 [slave pointer (2)]
⎜ ↳ DELL0A21:00 06CB:CE65 Touchpad id=12 [slave pointer (2)]
⎜ ↳ DELL0A21:00 06CB:CE65 Mouse id=13 [slave pointer (2)]
⎜ ↳ PS/2 Generic Mouse id=18 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Video Bus id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Intel HID events id=14 [slave keyboard (3)]
↳ Intel HID 5 button array id=15 [slave keyboard (3)]
↳ Dell WMI hotkeys id=16 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=17 [slave keyboard (3)]
↳ Microsoft Microsoft Pro Intellimouse Keyboard id=19 [slave keyboard (3)]
This time I ran the query list to check the virtual microsoft pro intellimouse keyboard (id 19) and this time it shows up at least 2 keys when I hold down the middle mouse button (I had to really shrink the terminal text to make it fit on the screen). These were:
key[23]=down
key[133]=down
There may or may not have been additional keys, but by that point the text was too small for me to detect a change.
So it seems that the intelimouse registers a virtual keyboard, and when I press the mouse button down, it is registering multiple keyboard buttons when I press down on the button. It feels to me like the mouse is "rememebering" a previous owners custom macro?
Xev Output
If I run xev and middle click inside the box, this text appears between the motion event outputs
MotionNotify event, serial 41, synthetic NO, window 0x5a00001,
root 0x7bb, subw 0x5a00002, time 1633827, (67,28), root:(938,471),
state 0x10, is_hint 0, same_screen YES
EnterNotify event, serial 41, synthetic NO, window 0x5a00001,
root 0x7bb, subw 0x0, time 1633828, (68,28), root:(939,471),
mode NotifyNormal, detail NotifyInferior, same_screen YES,
focus YES, state 16
KeymapNotify event, serial 41, synthetic NO, window 0x0,
keys: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
MotionNotify event, serial 41, synthetic NO, window 0x5a00001,
root 0x7bb, subw 0x0, time 1633828, (68,28), root:(939,471),
state 0x10, is_hint 0, same_screen YES
Xinput properties
Running:
xinput list-props "Microsoft Microsoft Pro Intellimouse Mouse"
outputs:
Device 'Microsoft Microsoft Pro Intellimouse Mouse':
Device Enabled (189): 1
Coordinate Transformation Matrix (191): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Natural Scrolling Enabled (327): 0
libinput Natural Scrolling Enabled Default (328): 0
libinput Scroll Methods Available (329): 0, 0, 1
libinput Scroll Method Enabled (330): 0, 0, 0
libinput Scroll Method Enabled Default (331): 0, 0, 0
libinput Button Scrolling Button (332): 2
libinput Button Scrolling Button Default (333): 2
libinput Button Scrolling Button Lock Enabled (334): 0
libinput Button Scrolling Button Lock Enabled Default (335): 0
libinput Middle Emulation Enabled (336): 0
libinput Middle Emulation Enabled Default (337): 0
libinput Accel Speed (338): 0.000000
libinput Accel Speed Default (339): 0.000000
libinput Accel Profiles Available (340): 1, 1
libinput Accel Profile Enabled (341): 1, 0
libinput Accel Profile Enabled Default (342): 1, 0
libinput Left Handed Enabled (343): 0
libinput Left Handed Enabled Default (344): 0
libinput Send Events Modes Available (312): 1, 0
libinput Send Events Mode Enabled (313): 0, 0
libinput Send Events Mode Enabled Default (314): 0, 0
Device Node (315): "/dev/input/event6"
Device Product ID (316): 1118, 2090
libinput Drag Lock Buttons (345): <no items>
libinput Horizontal Scroll Enabled (346): 1
libinput Scrolling Pixel Distance (347): 15
libinput Scrolling Pixel Distance Default (348): 15
libinput High Resolution Wheel Scroll Enabled (349): 1