0

Out of the box, this Logitech M325 mouse works great with one issue: cannot use the scroll wheel for horizontal scrolling. It acts as forward or back in the browsers or does nothing in other windows.

2

In order to make the horizontal scrolling work, I had to remap the mouse buttons. Check the mapping using xmodmap -pp:

[sly@SlyLap ~]$ xmodmap -pp
There are 24 pointer buttons defined.

    Physical        Button
     Button          Code
        1              1
        2              2
        3              3
        4              4
        5              5
        6              6
        7              7
        8              8
        9              9
       10             10
       11             11
       12             12
       13             13
       14             14
       15             15
       16             16
       17             17
       18             18
       19             19
       20             20
       21             21
       22             22
       23             23
       24             24

Use xev to find out the button codes for horizontal scrolling:

[sly@SlyLap ~]$ xev
...
ButtonPress event, serial 29, synthetic NO, window 0x5400001,
    root 0xad, subw 0x5400002, time 173143560, (21,37), root:(25,493),
    state 0x0, button 8, same_screen YES
...
ButtonPress event, serial 29, synthetic NO, window 0x5400001,
    root 0xad, subw 0x5400002, time 173126732, (21,37), root:(25,493),
    state 0x0, button 9, same_screen YES

From here I can see the left/right button codes are 8/9. Since the synaptics driver uses the buttons 6/7 for left/right scrolling, I simply needed to swap the order of how the buttons are declared. To change the mapping:

xmodmap -e "pointer = 1 2 3 4 5 8 9 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24"

This will swap 8/9 6/7 which will make the horizontal scrolling work.

  • 1
    This is the easiest and most straightforward way to remap mouse buttons. – asdmin Dec 12 '17 at 10:25
1

Using xmodmap resulted in problems with sideways scrolling using the touchpad on my laptop. I got the M325 mouse working as expected, but the touchpad sideways scrolling was changed to Back/Forward.

To remap mouse buttons only (leaving the touchpad alone) I used the instructions in https://askubuntu.com/questions/492744/how-do-i-automatically-remap-buttons-on-my-mouse-at-startup

I saved the following script as ~/logitechM325

#!/bin/bash
# Swap buttons 8 9 with buttons 6 7 -- Sideways scrolling with Logitech M325
logitech_mouse_id=$(xinput | grep "Logitech Unifying Device. Wireless PID:400a" | awk {'print substr($8,4,2)'})
echo $logitech_mouse_id > ~/temp/logitech_mouse_id
echo $logitech_mouse_id
xinput set-button-map $logitech_mouse_id 1 2 3 4 5 8 9 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

I made sure the script was executable:

$ sudo chmod a+x ~/logitechM325 

and then added it to the list of Startup Applications.

Now both the Logitech M325 and the touchpad work for sideways scrolling.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.