Skip to content

Instantly share code, notes, and snippets.

@sulph68
Created June 15, 2025 04:49
Show Gist options
  • Select an option

  • Save sulph68/0104e79fce6936c2e563acb11af8daa3 to your computer and use it in GitHub Desktop.

Select an option

Save sulph68/0104e79fce6936c2e563acb11af8daa3 to your computer and use it in GitHub Desktop.
uConsole MouseKeys Setup

uConsole MouseKeys Setup

As the trackball on the uConsole can be tricky, i used the YXBA buttons to move the cursor for more refined movements. This is done via ydotool and ydotoold in order to work with wayland.

References

Important to know that ydotool should be built from source in order to provide relative mouse movements.

Once built and installed, ydotoold should be started as root listening to a socket file, but changing socket ownershop to a target user. I added the following to rc.local

/usr/local/bin/ydotoold --socket-path="/tmp/.ydotool_socket" --socket-own="1002:1002" &

The user is also added to the input user group to ensure that the events can be read from the device correctly.

An app (keyscan) that listens to the input events from the keyboard then maps the keys to move the mouse cursor. The select key is also mapped to toggle a larger mouse movement via another script mousemove_m.sh.

my $device = "/dev/input/by-id/usb-ClockworkPI_uConsole_20230713-event-joystick";

[...some code ...]

    288 => 'mousemove.sh up',
    289 => 'mousemove.sh right',
    290 => 'mousemove.sh down',
    291 => 'mousemove.sh left',
    296 => 'mousemove_m.sh',

The mousemove.sh script is used to actually move the mouse.

#!/bin/bash

if [ -e "/tmp/mousekey.tmp" ]; then
	MM=40
else
	MM=8
fi

case "$1" in
  up)
    # echo "You chose UP"
    # Put your actual command here
		ydotool mousemove -x 0 -y -$MM
    ;;
  down)
    # echo "You chose DOWN"
    # Put your actual command here
		ydotool mousemove -x 0 -y $MM
    ;;
  left)
    # echo "You chose LEFT"
    # Put your actual command here
		ydotool mousemove -x -$MM -y 0
    ;;
  right)
    # echo "You chose RIGHT"
    # Put your actual command here
		ydotool mousemove -x $MM -y 0
    ;;
  *)
    echo "Usage: $0 {up|down|left|right}"
    exit 1
    ;;
esac

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