DreadPirateLynx / input-remapper-xautopresets

Automatic input-remapper preset manager for systems with access to xdotool and xprop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working on Kubuntu 22.04 - Logitech MX Master 3

TerrorSquad opened this issue · comments

Hi,

I'm not able to get this working under Kubuntu 22.04 and Logitech MX Master 3 mouse. Hopefully, it's just a matter of wrong config on my part...

Here is my configuration:
image

Basically, I want to bind the thumb button to the Toggle Fullscreen action inside my browsers and Toggle ZenMode inside IDEs.
This configuration works without input-remapper-xautopresets. But I would like to use the xautopresets as well since I'm using different shortcuts. In IDEs I want to trigger Shift+Alt+K while in browsers I want to trigger F11.

Can you please review my configuration and point out what' wrong with it and help me make it work?

Thanks!

Could you please post your application and device logs?

Here are the application logs.

xautopresets.log
Active window has changed!
Class: Code
Title: xautopresets.log - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Code
Title: browsers.json - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Code
Title: IDEs.json - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Code
Title: xautopresets.ini - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Not working on Kubuntu 22.04 - Logitech MX Master 3 · Issue #4 · DreadPirateLynx/input-remapper-xautopresets - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Code
Title: xautopresets.ini - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Code
Title: xautopresets.log - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Not working on Kubuntu 22.04 - Logitech MX Master 3 · Issue #4 · DreadPirateLynx/input-remapper-xautopresets - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Code
Title: xautopresets.log - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Not working on Kubuntu 22.04 - Logitech MX Master 3 · Issue #4 · DreadPirateLynx/input-remapper-xautopresets - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: New Tab - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: https://www.google.com/search?q=markdown+collapsible&oq=markdown+collap&aqs=chrome.1.69i57j0i512l6.2947j0j7&sourceid=chrome&ie=UTF-8 - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: markdown collapsible - Google pretraga - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: How to add a collapsible section in markdown. - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: TypeScript with Composition API | Vue.js - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Template Refs | Vue.js - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Vue.js - The Progressive JavaScript Framework | Vue.js - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Things I Don't Know as of 2019 (In Programming) - YouTube - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Design Docs at Google - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: How to add a collapsible section in markdown. - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Code
Title: xautopresets.log - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: How to add a collapsible section in markdown. - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Code
Title: xautopresets.log - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: How to add a collapsible section in markdown. - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: TypeScript with Composition API | Vue.js - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Template Refs | Vue.js - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: vue ref typescript array - Google pretraga - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Array.prototype.filter() - JavaScript | MDN - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: TypeScript Arrays - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: typescript let array - Google pretraga - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Vue.js - The Progressive JavaScript Framework | Vue.js - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Command in std::process - Rust - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: rust execute shell command - Google pretraga - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Not working on Kubuntu 22.04 - Logitech MX Master 3 · Issue #4 · DreadPirateLynx/input-remapper-xautopresets - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Software Engineer Qualification Levels: Junior, Middle, and Senior | HackerNoon - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Not working on Kubuntu 22.04 - Logitech MX Master 3 · Issue #4 · DreadPirateLynx/input-remapper-xautopresets - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Code
Title: xautopresets.log - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Google-chrome
Title: Not working on Kubuntu 22.04 - Logitech MX Master 3 · Issue #4 · DreadPirateLynx/input-remapper-xautopresets - Google Chrome

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------


Active window has changed!
Class: Code
Title: xautopresets.log - input-remapper - Visual Studio Code

Reading configuration file...
Done!


Active Presets:



---------------------------------------------------------------



How to see device logs?

There should be a file titled Logitech MX Master 3.log in the same folder as xautopresets.log, but something's going wrong somewhere. It doesn't look like xautopresets sees the device is connected.

Could you do me a favor and post the output of input-remapper-control --list

Alright.

The command doesn't output anything if I run it as a normal user.
However, when I run it as the root user I get this:

sudo input-remapper-control --list        
[sudo] password for gninkovic: 
input-remapper Logitech MX Master 3 forwarded
input-remapper keyboard
Logitech MX Master 3
DuckyChannel International Co., Ltd. Ducky Keyboard
Logitech K780
Logitech K750
RODE Microphones RODE NT-USB Consumer Control
Logitech BRIO Consumer Control

That is definitely the problem; xautopresets uses that command to get the list of connected devices, so if that's not working, nothing will

How do we fix it?

I'm pretty sure we just need to add your user to the right user group. Give me a few minutes while I figure this out

could you please post the output of groups [yourusername]?

groups $(whoami) 
gninkovic : gninkovic adm cdrom sudo dip plugdev input lpadmin lxd sambashare docker

Okay, so since I don't remember adding myself to a group to make this work, and I can't find any information about it, I'm going to ask you to try adding yourself to groups that I'm a member of, one at a time, until it works. If any of these groups don't already exist on your system, just skip them for the time being:

sys
games
wheel
realtime

EDIT: I tried removing myself, but it didn't change anything. I'm starting to wonder if this is actually a groups problem and not something else

I'm getting the same results, it doesn't work.

Is there anything else I might try?

I'll keep looking. In the meantime, you could try adding some of the other groups I'm a member of, but they seem much less likely to be the culprit:

libvirt
scanner
cups
lp
kvm
video

I'll try that.

So, the problem is related to the original command not returning anything when invoked as a regular user? It's not related to xautopresets?

That's what it looks like at this point. I posted in their discussions tab to see if anyone knows what's happening. Is it possible the input-remapper service is running as your user instead of root?

Okay, I added my user to all these groups and nothing changed.

The input-remapper-service is running as root.

❯ ps aux | rg -i input
root         898  0.0  0.0 1809148 35728 ?       Ssl  14:45   0:00 /usr/bin/python3 /usr/bin/input-remapper-service
root        1054  0.0  0.0  54732 21936 ?        S    14:45   0:00 /usr/bin/python3 /usr/bin/input-remapper-service
gninkov+    2343  0.6  0.0  14068  5256 ?        Ss   14:46   0:29 /bin/bash /home/gninkovic/.local/bin/input-remapper-xautopresets
root        3898  0.4  0.0 1809300 26568 ?       S    14:46   0:18 /usr/bin/python3 /usr/bin/input-remapper-service
gninkov+  613247  0.0  0.0   8480  5960 pts/1    S+   15:57   0:00 rg -i input

As it stands, I currently have no idea what the problem is. If you'd like, you can try adding sudo before input-remapper-control --list on line 321 of /home/gninkovic/.local/bin/input-remapper-xautopresets, then restarting the service. The command is run every time the active window changes, so if it keeps pestering you for a password, run sudo visudo and add this in the User privilege specification section: gninkovic ALL=(ALL) NOPASSWD: /usr/bin/input-remapper-control --list

Almost there.

Editing the sudoers file exactly as you suggested did not work, but after I put the line after the %sudo line, it did work.
https://askubuntu.com/a/100112

Also, I had to add sudo in front of the other two commands that start and stop injection inside the /home/gninkovic/.local/bin/input-remapper-xautopresets.

Now, I'm facing a different issue.

Namely, after I switch windows the mouse gets disconnected for a short while, gets connected again and injection happens. The functionality is there, but it is jerky.

My window activation policy is set to "Focus follows mouse"
image

Here is the output from journalctl

сеп 27 00:38:55 5600X systemd-udevd[118797]: input91: Process '/bin/input-remapper-control --command autoload --device ' failed with exit code 2.
сеп 27 00:38:55 5600X systemd-udevd[118802]: event29: /etc/udev/rules.d/99-whatpulse-input.rules:1 Only network interfaces can be renamed, ignoring NAME="input/%k".
сеп 27 00:38:56 5600X systemd-udevd[118797]: mouse2: Process '/bin/input-remapper-control --command autoload --device /dev/input/mouse2' failed with exit code 4.
сеп 27 00:38:56 5600X systemd-udevd[118802]: event29: Process '/bin/input-remapper-control --command autoload --device /dev/input/event29' failed with exit code 4.
сеп 27 00:38:56 5600X systemd-logind[915]: Watching system buttons on /dev/input/event29 (input-remapper Logitech MX Master 3 forwarded)
сеп 27 00:38:56 5600X kded5[119000]: Initializing  "/usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/kcms/systemsettings/kcm_mouse.so"
сеп 27 00:38:56 5600X kwin_x11[2559]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 29105, resource id: 146800645, major code: 18 (ChangeProperty), minor code: 0
сеп 27 00:39:03 5600X sudo[119918]: gninkovic : PWD=/home/gninkovic/.config/input-remapper ; USER=root ; COMMAND=/usr/bin/input-remapper-control --list-devices
сеп 27 00:39:03 5600X sudo[119918]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
сеп 27 00:39:03 5600X sudo[120109]: gninkovic : PWD=/home/gninkovic/.config/input-remapper/presets/Logitech MX Master 3 ; USER=root ; COMMAND=/usr/bin/input-remapper-control --command stop --device Logitech MX Master 3
сеп 27 00:39:03 5600X sudo[120109]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
сеп 27 00:39:03 5600X sudo[119918]: pam_unix(sudo:session): session closed for user root
сеп 27 00:39:03 5600X input-remapper-service[898]: Loaded config from "/home/gninkovic/.config/input-remapper/config.json"
сеп 27 00:39:03 5600X input-remapper-service[898]: Loaded config from "/home/gninkovic/.config/input-remapper/config.json"
сеп 27 00:39:03 5600X input-remapper-service[898]: Stopping injecting keycodes for group "Logitech MX Master 3"
сеп 27 00:39:03 5600X sudo[120109]: pam_unix(sudo:session): session closed for user root
сеп 27 00:39:04 5600X acpid[884]: input device has been disconnected, fd 32
сеп 27 00:39:04 5600X sudo[120248]: gninkovic : PWD=/home/gninkovic/.config/input-remapper ; USER=root ; COMMAND=/usr/bin/input-remapper-control --list-devices
сеп 27 00:39:04 5600X sudo[120248]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
сеп 27 00:39:04 5600X sudo[120248]: pam_unix(sudo:session): session closed for user root

Okay, this issue is larger than expected. Sometimes after switching presets, a preset will become stuck(?) and consistently trigger the Shift and Meta keys (could be just Meta, not completely sure), leading to an unusable desktop. I'm not able to open a new program or enter a previous one. Disconnecting the mouse and entering a new TTY (Alt+F4) to stop the injection solves the issue.

There's a "pause" that occurs which is entirely the result of switching profiles with input-remapper-control; there's nothing I can do on my end to reduce or eliminate it. I'd recommend switching to focus on click, rather than hover to minimize unnecessary injections.

Is this what you're describing, or am I misunderstanding?

Oh, and turn off autoload in input-remapper. It's not necessary and may notbe playing nice

Yes, that's exactly what's happening.

Removing autoload did not help. Changing the focus to on click also did not help.

Desktop would become stuck after a few alt-tabs and focus switches.

Short update:
Changing the sleep 0.1s to sleep 1s at the very end of ~/.local/bin/input-remapper-xautopresets solved my issue.
0.1s was just way too fast to respond to changes.

I'm so sorry it took so long to respond; I thought I already had.

As far as things getting stuck: input-remapper has a difficult time when keys are depressed on a device while it changes that device's profile. Best practice at the moment is to ensure that you aren't holding down keys on a device when its profile changes.

Could you please elaborate on the change you made having fixed your issue? I had lowered that value in an effort to reduce the lag between changing window focus and the appropriate profile being loaded. Did you attempt any values between these two? Were you aware that you shouldn't be holding down keys on a device while its profile changed?

If the answer to that second question is "No," then that's entirely on me and I should make a note of it prominently in the readme.

Sorry, I currently have keyboards/mice to two different computers in front of me and closed this thread by mistake.

EDIT: That doesn't make sense the more I think about it. I must have hit the wrong button.

I think I might change that pause to be configurable in the .ini file. Individual reaction times paired with the current requirement to release keys before the device is reprogrammed are starting to make me think this value should be configurable.

Real quick note about not holding keys while device profiles change:

The _IGNORE profile is your friend here. For example: I'm running KDE; if I _IGNORE window class kwin (my alt-tab "browser"), I ensure profiles won't change while alt-tabbing.

If you need help figuring out what class to _IGNORE, run input-remapper-xautopresets getwindowinfo, then alt-tab, release tab but still hold alt, then click on the appropriate area of the screen. Use window title to further isolate the behavior if necessary or desired.

Hi!

I've been super busy this week and didn't have time to respond.

Could you please elaborate on the change you made having fixed your issue? I had lowered that value in an effort to reduce the lag between changing window focus and the appropriate profile being loaded. Did you attempt any values between these two? Were you aware that you shouldn't be holding down keys on a device while its profile changed?

I wasn't aware of the fact that I shouldn't be holding down keys while the profile changes.

The change that I had thought solved my issue was increasing the sleep time from 0.1s to 1s. But after additional testing, I had found that it didn't actually solve anything, because of the issue you mentioned.
I reverted the value back to 0.1s.

After reading your last comment about the _IGNORE value, I decided to give it a whirl and test.
This is my current configuration

[GLOBAL]

[Logitech MX Master 3]
_DEFAULT=desktop
Input-remapper-gtk=_STOP
kwin=_IGNORE
Code=IDEs
jetbrains-phpstorm=IDEs
Google-chrome=browsers
firefox=browsers
konsole=terminals
Terminator=terminals

It is working fine, with almost no issues. Keys still sometimes get stuck, but an Alt+Tab (to switch the profiles) fixes the issue.

Glad to hear things are working alright now.

Now I just have to figure out how I'm going to incorporate a fix for the sudo problem into the release and installer.

I'll leave the issue open until I push an automated fix

You've also convinced me to look into ways to prevent a device's profile from changing automatically while buttons on that device are being held down.

Hm, that sounds more like an issue for the actual input-remapper rather than this tool.

While I agree in principle,

A) It's unlikely to become a priority since it's only really an issue when using tools like mine

B) If there's a way for me to circumvent the problem until they fix it, I might as well.

You've also convinced me to look into ways to prevent a device's profile from changing automatically while buttons on that device are being held down.

Kinda necro-ing this issue here (and I can open a new one if you prefer); this is the one annoying thing about auto switching profiles for me. E.g. if I switch back to $game and start pressing keys, whatever I am currently pressing when the profile changes is stuck until I focus a different window (with a different / no profile) and press it again.

No idea if you can do anything about that (e.g. delay the profile switch until no key is pressed or something), but it would be great if you could :)

Haha, I’ve recently become annoyed by keys getting stuck again. I totally forgot I had posted here, and was going to again m)

tl;dr: anything new on that front? I’ve even looked into re-implementing in Python or something, but its keyboard module doesn’t have a global “is any key currently down?” thing either, sadly.