Skip to content
/ ratslap Public
forked from krayon/ratslap

RatSlap: Linux configuration tool for Logitech mice (currently only G300S)

License

Notifications You must be signed in to change notification settings

sanikk/ratslap

 
 

Repository files navigation

     ##### /##                          #######  ###
  ######  / ##                        /       ### ###
 /#   /  /  ##                 #     /         ##  ##
/    /  /   ##                ##     ##        #   ##
    /  /    /                 ##      ###          ##
   ## ##   /       /###     ######## ## ###        ##      /###       /###
   ## ##  /       / ###  / ########   ### ###      ##     / ###  /   / ###  /
   ## ###/       /   ###/     ##        ### ###    ##    /   ###/   /   ###/
   ## ##  ###   ##    ##      ##          ### /##  ##   ##    ##   ##    ##
   ## ##    ##  ##    ##      ##            #/ /## ##   ##    ##   ##    ##
   #  ##    ##  ##    ##      ##             #/ ## ##   ##    ##   ##    ##
      /     ##  ##    ##      ##              # /  ##   ##    ##   ##    ##
  /##/      ### ##    /#      ##    /##        /   ##   ##    /#   ##    ##
 /  ####    ##   ####/ ##     ##   /  ########/    ### / ####/ ##  #######
/    ##     #     ###   ##     ## /     #####       ##/   ###   ## ######
#                                 |                                ##
 ##                                \)                              ##
                                                                   ##
                                                                    ##

Linux configuration tool for Logitech mice //(currently only G300S)//

Introduction

RatSlap aims to provide a way to configure configurable Logitech mice from within Linux.

Availability

RatSlap source is available on GitLab, GitHub and BitBucket with the primary (public) repository being GitLab.

Bug Tracker

Bugs are tracked on the Quadronyx Bug Tracker.

Usage

The Logitech G300s has 3 button modes. For each of these modes, you can assign an LED colour, report rate (speed at which the mouse communicates with the computer), DPI setting(s) and button/key combinations.

NOTE: You cannot remap the scrollwheel. These generate button 4 (up) and 5 (down) and cannot be changed.

The default mapping for F3 on the G300s, for example, is currently:

$ ratslap -pf3
Printing Mode: F3
  Colour:              cyan
  Report Rate:          500
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           NOT SET
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  Button6
  G5:                  Button7
  G6:                  LeftCtrl +
  G7:                  LeftAlt +
  G8:                  ModeSwitch
  G9:                  DPICycle

Remapping to just mouse buttons

One usage for RatSlap may be to remap the buttons to generate standard mouse buttons higher than the 1-3 + scrollwheel (4 and 5).

Above, we see a typical button 1/2/3 configuration for left, right and middle respectively. We can also see the G4 button generates mouse button 6 and G5 generates mouse button 7. Unfortunately, G6-G9 do not generate the desired extra

We can rectify this easily, using RatSlap:

$ ratslap --modify F3 --colour Magenta --G6 Button8 --G7 Button9 --G8 Button10 --G9 Button11
Modifying Mode: F3
    Setting colour: magenta
    Setting button 6: Button8
    Setting button 7: Button9
    Setting button 8: Button10
    Setting button 9: Button11
Saving Mode: F3

Now, we have all mouse buttons functioning as mouse buttons! Go figure! And as an added bonus, we have a nice Magenta glow.

$ ./ratslap --print F3
Printing Mode: F3
  Colour:              magenta
  Report Rate:          500
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           NOT SET
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  Button6
  G5:                  Button7
  G6:                  Button8
  G7:                  Button9
  G8:                  Button10
  G9:                  Button11

Finally, we can select the F3 mode (if we're not already using it):

$ ./ratslap --select F3
Selecting Mode: F3

Firefox tab switching buttons

Another option might be using the buttons behind the wheel (G8 and G9) to switch forward and backward (respectively) between tabs in your favourite browser ... or Firefox.

So, let's set the buttons to Control-TAB and Control-Shift-TAB, print out our config, then switch to that mode:

$ ratslap --modify F3 --G8 LeftCtrl+TAB --G9 LeftCtrl+LeftShift+TAB --print F3 --select F3
Modifying Mode: F3
    Setting button 8: LeftCtrl+TAB
    Setting button 9: LeftCtrl+LeftShift+TAB
Saving Mode: F3

Printing Mode: F3
  Colour:              magenta
  Report Rate:          250
  DPI #1:               500
  DPI #2:        (DEF) 1000
  DPI #3:              1500
  DPI #4:              2500
  DPI Shift:           NOT SET
  Left Click (But1):   Button1
  Right Click (But2):  Button2
  Middle Click (But3): Button3
  G4:                  Button6
  G5:                  Button7
  G6:                  Button8
  G7:                  Button9
  G8:                  LeftCtrl + Tab
  G9:                  LeftCtrl + LeftShift + Tab

Selecting Mode: F3

History

I recently (October 2016) purchased a Logitech G300S due mainly to the many extra buttons. I didn't care that the software didn't support Linux as I only wanted the extra buttons to generate extra mouse buttons, not keys or anything fancy.

Unfortunately, when I plugged it in, I discovered that none of the default 3 modes generated the extra mouse buttons I desired, instead generating useless and annoying keypress events such as CTRL-C, CTRL-X and CTRL-V.

Worse still, I also discovered that the Windows software only allows you to assign mouse buttons 1 through 7, skipping 4 and 5 (scroll-wheel). These are Left-Click (1), Middle-Click (2), Right-Click (3), Browser Back (6) and Browser Forward (7) respectively! --Hopefully this is a limitation in the Logitech software and not in the mouse itself-- (see Notes).

Features

  • Bind 9 mouse buttons instead of only the 5 that Logitech's tool offers.
  • Assign mouse clicks or keys to the Left and Right buttons.
  • Freely assign 'Mode Switch' to a mouse button in only one mode/profile.
  • Assign mouse clicks with key modifiers.

Version History

TODO

Notes

Technique to sniff USB traffic

https://julien.danjou.info/blog/2012/logitech-k750-linux-support shows a technique for sniffing USB traffic using the usbmon kernel module.

Unfortunately it looks like I'll need to create a Windows VM to run the Logitech software on :(

Logitech Software's Artificial Restrictions

After considerable testing, I have found some operations the hardware supports that Logitech's management software does not.

Firstly, I can confirm that we can actually set 9 mouse buttons (1, 2, 3, 6, 7, 8, 9, 10 and 11). This is good news as it was what I originally expected from the Logitech G300s in the first place :D

We can also re-assign left and right buttons to different keys/buttons. Logitech's software did not allow this, presumably to avoid accidentally removing your ability to actually "left-click" anything :P

Once you assigned the 'Mode Switch' to a button in one profile/mode, it was also set in the other profiles/modes. This is presumably so you can always change to another mode. We shall impose no such limitation.

Lastly, and perhaps rather attractively, we can assign mouse buttons to perform mouse clicks WITH modifiers! You can therefore bind Ctrl+Shift+Right-Click to the left mouse button if you so desire.

<<< vim:set ts=4 sw=4 tw=80 et cindent ai si syn=creole: >>>

About

RatSlap: Linux configuration tool for Logitech mice (currently only G300S)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 87.8%
  • Makefile 10.2%
  • C++ 2.0%