panzi / qjoypad

fork of qjoypad http://qjoypad.sourceforge.net/
GNU General Public License v2.0
120 stars 25 forks source link

[Feature Request] Change Mouse Speed based on another Button #51

Open dginovker opened 2 years ago

dginovker commented 2 years ago

When trying to control the mouse pointer via some joysticks, accurate precision is almost impossible. One solution is the speed could being decreased while a key is held down.

Because QJoyPad calls xtestfakerelativemotionevent, it's not possible to manually decrease pointer speed via hotkeys through other applications to achieve this effect, since decreasing pointer speed has no effect on xtestfakerelativemotionevent.

dginovker commented 2 years ago

From the code:

//signal handler for SIGUSR2
//SIGUSR2 means that a new layout should be loaded. It is saved in
// ~/.qjoypad/layout, where the last used layout is put.
void catchSIGUSR2( int sig ) {
    if (layoutManagerPtr) layoutManagerPtr->load();
    //remember to catch this signal again next time.
    signal( sig, catchSIGUSR2 );
}

If I can swap out the default configuration file on the fly with another identical one but lower mouse sensitivity, I can reload it with kill -USR2 $(pgrep qjoypad). Maybe I can do something with that

dginovker commented 2 years ago

Got a workaround if anyone is curious:

#! /bin/bash

cd $HOME/.config/qjoypad4 # depends on https://github.com/panzi/qjoypad/pull/50

cp "My Layout.lyt" temp
cp "My Layout 2.lyt" "My Layout.lyt"
cp temp "My Layout 2.lyt"

kill -USR2 $(pgrep qjoypad)                                 

My Layout.lyt and My Layout 2.lyt are identical except for the maxSpeed on their Axis 1 and 2