Skip to content

Instantly share code, notes, and snippets.

@jerblack
Last active February 6, 2022 10:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerblack/84c9cea75ea7802a94f4b16cf21e81d3 to your computer and use it in GitHub Desktop.
Save jerblack/84c9cea75ea7802a94f4b16cf21e81d3 to your computer and use it in GitHub Desktop.
Remap Mouse and Keyboard in Ubuntu

Using the X4daemon to enable the extra buttons on the SideWinder X4 Keyboard

NO packages are available for this daemon so we have to build from source. http://geekparadise.de/x4daemon

  • The page above links to the source. Download this file and extract to ~.x4

  • Install libusb headers

    sudo apt install libusb-1.0-0-dev

  • Before compiling, update the file ~/.x4/x4daemon-0.4.4/src/x4daemon.c. Add the following headers to the bottom of the list at line 32

#include <sys/stat.h>
#include <sys/param.h> 
#include <sys/types.h> 
  • Compile the program

     cd ~/.x4/x4daemon-0.4.4/
     ./configure
     make
     # verify it works by running cmd below and testing keys
     sudo x4daemon -w
    
  • Start the daemon at logon by adding the line below to /etc/rc.local (which starts as root at logon)

     x4daemon -w -D
    
  • Buttons are mapped to alternate but standard keyboard keys

    KEY_PROG1, KEY_PROG2, KEY_WWW, KEY_MAIL, KEY_COMPUTER, KEY_PHONE, KEY_MEDIA, KEY_RECORD, KEY_PLAYPAUSE, KEY_PREVIOUSSONG, KEY_NEXTSONG, KEY_MUTE, KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_CALC

  • Use xev to find out which key is which

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment