sezanzeb / input-remapper

🎮 ⌨ An easy to use tool to change the behaviour of your input devices.
GNU General Public License v3.0
3.93k stars 160 forks source link

Sensitivity reset after injection #358

Open zerowhybr opened 2 years ago

zerowhybr commented 2 years ago

Hello, I am facing an issue regarding pointer speed (mouse sensitivity) after injection happens. I have set on KDE Plasma settings app to lower the sensitivity of my mouse, but after boot it does not persist as input-remapper injection ends and the pointer speed goes back to default. After I manually change the pointer speed on the settings to another value and back to what I want or click on stop injection it goes back to working normally. Maybe add a way to control pointer speed on your app is a workaround. I don't know if it is possible to not touch pointer speed on injection.

Some logs:

  1. input-remapper-control --version:

    input-remapper 1.4.2 5f53ae8c7b7e97dd02cf805cba6396637008c9e3 https://github.com/sezanzeb/input-remapper
    python-evdev 1.4.0
  2. which linux distro (ubuntu 20.04, manjaro, etc.): Arch Linux

  3. echo $XDG_SESSION_TYPE: x11

  4. which desktop environment (gnome, plasma, xfce4, etc.): KDE Plasma

  5. sudo ls -l /proc/1/exe: lrwxrwxrwx 1 root root 0 mar 28 10:24 /proc/1/exe -> /usr/lib/systemd/systemd

  6. cat ~/.config/input-remapper/config.json:

    {
    "version": "1.4.2",
    "autoload": {
        "HID 1bcf:08a0 Mouse": "Default"
    },
    "macros": {
        "keystroke_sleep_ms": 10
    },
    "gamepad": {
        "joystick": {
            "non_linearity": 4,
            "pointer_speed": 80,
            "left_purpose": "none",
            "right_purpose": "none",
            "x_scroll_speed": 2,
            "y_scroll_speed": 0.5
        }
    }
    }
  7. input-remapper-control --command hello:

    Connected to the service
    Daemon answered with "hello"
    Done
  8. systemctl status input-remapper -n 50:

    
    ● input-remapper.service - Service to inject keycodes without the GUI application
     Loaded: loaded (/usr/lib/systemd/system/input-remapper.service; enabled; vendor preset: disabled)
     Active: active (running) since Mon 2022-03-28 10:24:35 -03; 17min ago
    Main PID: 509 (input-remapper-)
      Tasks: 5 (limit: 16695)
     Memory: 38.3M
        CPU: 12.990s
     CGroup: /system.slice/input-remapper.service
             ├─ 509 /usr/bin/python3 /usr/bin/input-remapper-service
             ├─ 563 /usr/bin/python3 /usr/bin/input-remapper-service
             └─1108 /usr/bin/python3 /usr/bin/input-remapper-service

mar 28 10:24:34 user-pc systemd[1]: Starting Service to inject keycodes without the GUI application... mar 28 10:24:35 user-pc input-remapper-service[509]: Starting logging to "/var/log/input-remapper" mar 28 10:24:35 user-pc input-remapper-service[509]: input-remapper-service 1.4.2 5f53ae8c7b7e97dd02cf805cba6396637008c9e3 https://github.com/sezanzeb/input-remapper mar 28 10:24:35 user-pc input-remapper-service[509]: python-evdev 1.4.0 mar 28 10:24:35 user-pc systemd[1]: Started Service to inject keycodes without the GUI application.

sezanzeb commented 2 years ago

I don't know if it is possible to not touch pointer speed on injection.

it would be, yes. Related: https://github.com/sezanzeb/input-remapper/issues/99

but after boot it does not persist as input-remapper injection ends

you meant to say that the injection starts after boot, right?

zerowhybr commented 2 years ago

you meant to say that the injection starts after boot, right?

Yes, I believe it does that after boot because of SystemD launching the service. Basically, every time input-remapper applies its settings (in my case by clicking apply or because of the service) my mouse sensitivity is reset.

frederikpetersen commented 2 years ago

I experience the same issue.

When Input Remapper is injected it overrides my setting to disable mouse acceleration. I also use KDE Plasma. When I open system settings it shows the settings as they were before injecting. Enabling mouse acceleration and disabling it again fixes the issue, but I have to do this every time Input Remapper is injected.

Apart from this, the application works perfectly.

Version:

input-remapper 1.4.2 63f58f39271d51b7b9aa9e99eaa62aa8d7cbb09c https://github.com/sezanzeb/input-remapper
python-evdev 1.5.0
sezanzeb commented 2 years ago

This probably happens because input-remapper needs to grab the mouse device when mapping mouse buttons. There is no way around this as far as I can tell, because it needs to stop the original event from reaching the environment.

Grabbing stops all events from reaching the environment though, not just those that are mapped. It then creates a new device, for example "input-remapper USB Optical Mouse forwarded" to inject those again.

Probably the only way to prevent this from happening in KDE is probably to modify KDE to keep the setting when the mouse changes. So I would suggest bringing this to the KDE bugtracker so see what they think of this.

It could be that adjusting some device properties of the "forwarded" device to fully mimic the original device helps here, but this causes other problems.

I would have expected that KDE either keeps the setting no matter which mouse is used, or that it remembers to use that setting when the "forwarded" device appears.

bladeSk commented 2 years ago

I manged to work around this by adding this bash script to autostart login scripts:

#!/bin/bash
sleep 5 # wait a bit for the remapper to start

MOUSEID=$(xinput list --id-only 'pointer:input-remapper Logitech G603 forwarded')
if [ ! -z $MOUSEID ]; then
    xinput --set-prop $MOUSEID 305 0, 1
else
    echo 'not found'
fi

You can get the name and id of your remapped mouse by running xinput list and then list the configurable props by running xinput --list-props 30 (30 is the ID of my remapped mouse).

In my case, I just needed to disable acceleration (Accel Profile Enabled (305)) by setting it to "0, 1", you may want to adjust other values.

asbestosbill commented 1 year ago

Came here to ask about the same issue. I never made any changes to my mouse settings, but injecting makes it go wild. I'll try bladeSk's code, but I wasn't planning on having the preset autoload, so I don't know how useful it will be…

Mint 21.2, X11 MATE Desktop using v 2.0.0

asbestosbill commented 1 year ago

Okay, I guess my situation might be a bit different. My Acceleration Profile is set to Adaptive and Acceleration slider set all the way to Fast. Again, I did not set these myself, to my knowledge; presumably they are the Mint defaults. When I start injecting, I have to turn the acceleration slider almost all the way down to replicate the speed I'm used to, and when I stop, I have to turn it all the way back up. Changing the Acceleration Profile while injecting seems to have no effect.

andreamerello commented 9 months ago

Something similar here: I've set some properties with xinput including "coordinate transformation matrix", but once input-remapper starts, they are not honored anymore (still I can see them still set with xinput.

First time I've installed and run input-remapper, apparently it has been enough to re-run xinput and set the properties again; now at 2nd boot, with automatic injection at startup, I cannot fix my mouse in any way, except by stopping injection.