logiops icon indicating copy to clipboard operation
logiops copied to clipboard

Add Action type: "Axis" support for mapping buttons press to axis changes

Open S-trace opened this issue 3 years ago • 4 comments

This is something like Gesture mode: "Axis", but works on mouse buttons.

Configure it like the following (this example will re-map mouse wheel tilts to horizontal scrolling with increased speed):

buttons: (
    {
        # Tilt wheel left
        cid: 0x5b;
        action:
        {
            type: "Axis";
            axis: "REL_HWHEEL_HI_RES";
            move: -120;
            rate: 10;
        }
    },
    {
        # Tilt wheel right
        cid: 0x5d;
        action:
        {
            type: "Axis";
            axis: "REL_HWHEEL_HI_RES";
            move: 120;
            rate: 10;
        }
    }
)

Axis

This maps pressed buttons to axis change (scrolling etc) with configurable move distance and autorepeat rate.

axis

This is a required string/integer field that defines the axis to be changed. For a list of axis strings, refer to linux/input-event-codes.h. (e.g. axis: "REL_HWHEEL_HI_RES";). Alternatively, you may use integer axis code to define the axis.

move

This is an optional integer field that defines the axis change per one repeat. Use negative values to invert scroll direction. Regular/HI_RES axis ratio is 1/120 (1 step for regular axis == 120 steps for HI_RES axis). (e.g. move: -1;) The default value is 1 for the regular axis and 120 for the HI_RES axis.

rate

This is an optional integer field that defines autorepeat rate (ms). (e.g. rate: 100;) The default value is 100 (repeat axis change 10 times per second).

Fixes https://github.com/PixlOne/logiops/issues/153 Requires https://github.com/PixlOne/logiops/pull/245 to map REL_HWHEEL axis

S-trace avatar May 08 '21 22:05 S-trace

@PixlOne Could you please review the repeat task startup part - sometimes it starts only for one axis direction, but not for another one.

S-trace avatar May 08 '21 22:05 S-trace

I fixed the problem with repeat task startup, now it starts correctly every logid launch.

Can anyone review the repeat task body about HI_RES axis changes?

Is my approach (take move value, divide it by 120 and move the regular axis to resulted value and then move the HI_RES axis to remanded value) conceptually correct or not?

S-trace avatar May 09 '21 21:05 S-trace

+1 Nice work, thanks for working on this

syepes avatar May 11 '21 20:05 syepes

@PixlOne Are there any issues with this pull request? Do you plan to introduce this feature in your own implementation? If both are "no" - why didn't you yet merged this pull request?

S-trace avatar Dec 17 '21 21:12 S-trace