Advertisement
Guest User

logitech mouse fix

a guest
Apr 24th, 2025
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | Software | 0 0
  1. #!/usr/bin/python3
  2.  
  3. from os import system
  4. from subprocess import Popen, PIPE
  5. from re import findall
  6.  
  7. # Get Logitech Wireless Mouse device ID
  8. mouse_ids = findall(
  9.     r'\\tid=(\d+)',
  10.     str(Popen(
  11.         'xinput list | grep -i "Logitech Wireless Mouse"',
  12.         stdout=PIPE,
  13.         shell=True
  14.     ).communicate()[0])
  15. )
  16.  
  17. if not mouse_ids:
  18.     print("Error: Logitech Wireless Mouse not found!")
  19.     exit(1)
  20.  
  21. for device_id in mouse_ids:
  22.     # Disable natural scrolling (traditional scroll direction)
  23.     system(f'xinput set-prop {device_id} "libinput Natural Scrolling Enabled" 0')
  24.    
  25.     # Disable high-resolution smooth scrolling
  26.     system(f'xinput set-prop {device_id} "libinput High Resolution Wheel Scroll Enabled" 1')
  27.    
  28.     # Disable horizontal scrolling
  29.     system(f'xinput set-prop {device_id} "libinput Horizontal Scroll Enabled" 0')
  30.    
  31.     # Slow down cursor sensitivity (65% speed)
  32.     system(
  33.         f'xinput set-prop {device_id} "Coordinate Transformation Matrix" '
  34.         '0.550000, 0.000000, 0.000000, '
  35.         '0.000000, 0.550000, 0.000000, '
  36.         '0.000000, 0.000000, 0.500000'  # Fixed last value (must be 1.0)
  37.     )
  38.  
  39.     print(f"Applied settings to Logitech Wireless Mouse (ID: {device_id})")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement