Git Product home page Git Product logo

input-remapper's Introduction

Input Remapper

An easy to use tool to change the behaviour of your input devices.
Supports X11, Wayland, combinations, programmable macros, joysticks, wheels,
triggers, keys, mouse-movements and more. Maps any input to any other input.

Usage - Macros - Installation - Development - Examples

 

Installation

Manjaro/Arch
yay -S input-remapper-git
sudo systemctl restart input-remapper
sudo systemctl enable input-remapper
Ubuntu/Debian

Get a .deb file from the release page or install the latest changes via:

sudo apt install git python3-setuptools gettext
git clone https://github.com/sezanzeb/input-remapper.git
cd input-remapper && ./scripts/build.sh
sudo apt install -f ./dist/input-remapper-2.0.1.deb

input-remapper is available in Debian and Ubuntu.

input-remapper ≥ 2.0 requires at least Ubuntu 22.04.

Fedora
sudo dnf install input-remapper
sudo systemctl enable --now input-remapper
Manual

Dependencies: python3-evdev ≥1.3.0, gtksourceview4, python3-devel, python3-pydantic, python3-pydbus

Python packages need to be installed globally for the service to be able to import them. Don't use --user

Conda can cause problems due to changed python paths and versions.

If it doesn't seem to install, you can also try sudo python3 setup.py install

sudo pip install evdev -U  # If newest version not in distros repo
sudo pip uninstall key-mapper  # In case the old package is still installed
sudo pip install --no-binary :all: git+https://github.com/sezanzeb/input-remapper.git
sudo systemctl enable input-remapper
sudo systemctl restart input-remapper

Migrating beta configs to version 2

By default, Input Remapper will not migrate configurations from the beta. If you want to use those you will need to copy them manually.

rm ~/.config/input-remapper-2 -r
cp ~/.config/input-remapper/beta_1.6.0-beta ~/.config/input-remapper-2 -r

Then start input-remapper

input-remapper's People

Contributors

albanobattistella avatar alxpl avatar blueyed avatar coffebar avatar everyx avatar joebonrichie avatar jonasboss avatar jose1711 avatar kohend avatar lunnova avatar merrit avatar mjg avatar nlepage avatar nouraldeenm0 avatar pbaumard avatar pjamar avatar poldovico avatar rffontenelle avatar rocketraman avatar rokkoyama avatar sezanzeb avatar skitt avatar slhck avatar stasadev avatar timmarjo avatar tsantzi avatar ubunatic avatar xyzhou-1 avatar yngmjgsd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

input-remapper's Issues

Key won't release

openrazer/openrazer#1039 (comment)

@Amdarin I'm moving that discussion to this place

I was trying much more and I know what was happening. For ejemple the device have by default a pre-assigned keys, i just give you an example. 1 Key and 2 key have "1" and "2" preassigned so if you assign the same key by error or the first time you use the software and you don't know that it could happend then if you pressing the key 1 or 2 you will get a "1" or "2" repeting without stop. "1111111111111111111".... It's not an exactly a error but perhaps could show any message warning at the same moment of the setting up the keyboard. I was testing it with World of Warcraft and I can tell you the feeling and respond of the keyboard was pretty good. Also it could be good if we have profiles but I think it could be far of the focus project. I would like comment too that I have a razer basilisk V2 and one key of it is not reconize but I going to post it on the web project. Thank you for you support and effort..

Generating xkb configs

In order to add support for new keys to the injection that are yet unknown to the system layout, xkb configs have to be used. Otherwise only keys that are already present in the current keyboard layout can be used.

  • setxkbmap can crash the whole session if the config files are not correct
  • setxkbmap won't print useful error messages (It basically just does nothing at all except telling me that there is an "Error")
  • xkb configs are ugly and complicated
  • setxkbmap can't accept paths as argument, I have to put my files into /usr/share/X11/xkb/
  • xkb uses that ridiculous redundant "keycodes" file to map codes to names, only to map those names to characters afterwards
  • xmodmap doesn't support a path argument, so I'm stuck with that abomination called setxkbmap and those horrible config files

And my current main problem is: Using the setxkbmap command either doesn't do anything at all, or applies that stuff on all devices even with -device

Development is going on on the xkb branch, the interesting file for that stuff is https://github.com/sezanzeb/key-mapper/blob/xkb/keymapper/injection/xkb.py

Thanks.

Logitech mouse buttons 6 and 7

Good day sir,
I'm trying to set up a couple mouse buttons using a Logitech M705 mouse. In the Device drop down window I can choose Logitech M705. Left clicking under the Key column with button #2 I get BTN_MIDDLE and I can enter super_l in the mapping column. After saving and applying, I can press the middle button and the super_l is simulated which opens and closes the Activities Overview window perfectly. After pressing the Apply Defaults button and I press button 6 or 7 in the Key column nothing happens. If I execute the command 'xev' button 6 and 7 are recognized.

Looking forward to the feature of combining keys that you stated is getting close. I will be adding two modifiers and a key for button 6 and 7. Everything else is working fine. In fact using your program to simulate button 2 works exactly as if I was using the Super key. Xdotool and xte do not give me the same results pressing button #2

I'm running your software on a laptop that has POP_OS 20.04 installed. There will be some differences between button 2 and buttons 6 and 7. Using 'xev' when I press button 2 down I get one response and I get a second response when I release button 2. If I hold down button 6 or 7 down the buttons do a repeat until I release them.

Jim

Packing via debian/rules

To satisfy FTBFSIASW (https://ftp-master.debian.org/REJECT-FAQ.html). Apparently it should be possible to create .deb packages using dpkg-buildpackage -us -uc. scripts/build.sh would not be allowed

It is some sort of makefile, and I know nothing about those. I also seems quite troublesome to get it running like that. It would be nice if somebody who has done debian compliant deb packaging in the past could help out here.

Only works after first unlock

Thanks for making the app!

I have installed the deb package (version 0.6).
I am on pop-os 5.8.0-7630-generic #32160919370720.10~781bb80-Ubuntu.

I have autoload enabled and it works, but only after I unlock the screen for the first time since a reboot.
I want to be able to type a specific character that is part of my password while on the lockscreen.
Can I maybe just run a command to make the program start right after a reboot?
I tried adding
@reboot sudo systemctl start key-mapper && sudo systemctl enable key-mapper
to my crontab file but it didn't work.

Thanks for your help!

Wrong user in systemd daemon

Hello,

My environment: Arch, Wayland, Gnome.

It seems that function get_user() in keymapper/paths.py always returns root for systemd daemon on Wayland. Restaring service after log in results in the same thing. I'm using latest git version.

Here is status code:

❯  systemctl status key-mapper.service
● key-mapper.service - Service to inject keycodes without the GUI application
     Loaded: loaded (/usr/lib/systemd/system/key-mapper.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2021-01-09 06:54:09 CET; 2h 15min ago
   Main PID: 6911 (key-mapper-serv)
      Tasks: 3 (limit: 28485)
     Memory: 18.8M
     CGroup: /system.slice/key-mapper.service
             └─6911 /usr/bin/python3 /usr/bin/key-mapper-service

Jan 09 06:54:09 arch systemd[1]: Starting Service to inject keycodes without the GUI application...
Jan 09 06:54:09 arch key-mapper-service[6911]: Creating file "/home/root/.config/key-mapper/config.json"
Jan 09 06:54:09 arch key-mapper-service[6911]: Saved config to /home/root/.config/key-mapper/config.json
Jan 09 06:54:09 arch key-mapper-service[6912]: xmodmap:  unable to open display ''
Jan 09 06:54:09 arch key-mapper-service[6911]: This output is also stored in "~/.log/key-mapper"
Jan 09 06:54:09 arch key-mapper-service[6911]: Logging to "/root/.log/key-mapper/log"
Jan 09 06:54:09 arch key-mapper-service[6911]: key-mapper 0.6.0
Jan 09 06:54:09 arch key-mapper-service[6911]: python-evdev 1.3.0
Jan 09 06:54:09 arch systemd[1]: Started Service to inject keycodes without the GUI application.

Suggestion: Any plans on adding focus dependant configurations ?

I firstly want to congratulate you with your project, and for the commitent with it. That said, I was wandering if it's on the plans of the project of adding a focus window option, where if there's x window focused at the moment, change certain binding to another ones. It would be a very cool addition that I don't see in any other key binding apps on Linux. I wait for your response if it's possible or there's any limitation on the X Org or the DE way of dealing with focused windows.

could not open uinput device in write mode

Beautiful app, thanks for putting this together!

On trying to apply the keybindings, the app shows "Failed to apply preset":

image

The terminal shows the following:

Applying preset "Nordics" for "OLKB Preonic"
Loaded config from "/home/hannah/.config/key-mapper/config.json"
Stopping injecting keycodes for device "OLKB Preonic"
Loading preset from "/home/hannah/.config/key-mapper/presets/OLKB Preonic/Nordics.json"
Starting injecting the mapping for "OLKB Preonic"
Process Process-5:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.9/site-packages/keymapper/dev/injector.py", line 431, in _start_injecting
    uinput = evdev.UInput(
  File "/usr/lib/python3.9/site-packages/evdev/uinput.py", line 130, in __init__
    self.fd = _uinput.open(devnode)
OSError: could not open uinput device in write mode
ERROR: Injector was unexpectedly found stopped

I've tried the following:

  • Enable/disable "autoload" > no difference, same error
  • Instead of mapping to a Swedish character, map to just 1 > no difference, same error
  • Instead of mapping a key combination, map 1 to 1 > no difference, same error
  • Restart the program > no difference, same error

For background, installed via the AUR. The keyboard is running QMK through the QMK Configurator (so pretty simple configuration), system locale is System Locale: LANG=en_US.UTF-9.

Any idea what could be happening here?

Can't install on pop!_os 20.10

Hi there, trying to install.
I get the following:

$ sudo key-mapper-service --setup-permissions
Traceback (most recent call last):
  File "/usr/bin/key-mapper-service", line 38, in <module>
    from keymapper.daemon import Daemon, BUS_NAME
  File "/usr/lib/python3/dist-packages/keymapper/daemon.py", line 34, in <module>
    from keymapper.dev.injector import KeycodeInjector
  File "/usr/lib/python3/dist-packages/keymapper/dev/injector.py", line 31, in <module>
    import evdev
ModuleNotFoundError: No module named 'evdev'

If I try and install I get this:


$ sudo dpkg -i python3-key-mapper_0.3.1-1_all.deb
(Reading database ... 400745 files and directories currently installed.)
Preparing to unpack python3-key-mapper_0.3.1-1_all.deb ...
Unpacking python3-key-mapper (0.3.1-1) over (0.3.1-1) ...
dpkg: dependency problems prevent configuration of python3-key-mapper:
 python3-key-mapper depends on python3-evdev; however:
  Package python3-evdev is not installed.

dpkg: error processing package python3-key-mapper (--install):
 dependency problems - leaving unconfigured
Processing triggers for desktop-file-utils (0.24-1ubuntu4) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Errors were encountered while processing:
 python3-key-mapper

I'm on POP!_OS 20.10

App doesn't open on ZOrin OS

it seems like I need a password to open the app no 1. my OS is also not recognising it's install no 2 it's not opening

Caps Lock as Escape and Control

Hello 👋. I have read description and couldn't find whether that's possible to map Caps Lock to act as Escape, and as Ctrl if pressed chorded with another key.

Also I've seen there is problems with Ctrl and Shift.
Have you looked at https://gitlab.com/interception/linux/tools, https://gitlab.com/interception/linux/plugins/caps2esc.

As I understand they fully intercept key presses, so noone, including window manager knows about original event. And they substitute them with their own.

This way any exotic combinations should work as it's done at earliest level.

At least this is the only solution that allowed we to reliably map Escape and Ctrl to Caps Lock simultaneously. Would be nice to have that ability in your GUI.

Not running when starting via GUI

Hi, I'd like to quickly say that this is great! I reckon many people have been waiting for this and it will advance many distros in becoming more user friendly. Great work!

I'm on Elementary OS 5.1. I've been fiddling with xbindkeys and logiops to get my MX Keys and MX Master 3 to play nicely with my system. It's a lot of work to get things to function well. Today I discovered your app and hoped it could bring some ease to my headaches.

The Issue

I couldn't install the 0.4.0.deb with Eddy, so I tried directly from source. This seemed to install fine, but when I launch via applications, it pops up in the Dock for 5 seconds and then quits. No GUI. I ran sudo key-mapper-gtk -d

Loaded config from "/home/claus/.config/key-mapper/config.json"
Writing "/home/claus/.config/key-mapper/xmodmap.json"
INFO: logger.py, line 114, key-mapper 0.4.0
WARNING: logger.py, line 121, Debug level will log all your keystrokes! Do not post this output in the internet if you typed in sensitive or private information with your device!
DEBUG: logger.py, line 126, pid 11336
DEBUG: data.py, line 86, Found data at "/usr/share/key-mapper"

(key-mapper-gtk:11336): IBUS-WARNING **: 15:47:40.554: The owner of /home/claus/.config/ibus/bus is not root!

(key-mapper-gtk:11336): IBUS-WARNING **: 15:47:40.584: Unable to connect to ibus: Unexpected lack of content trying to read a line
DEBUG: getdevices.py, line 93, Discovering device paths
SPAM: getdevices.py, line 116, Found "LogiOps Virtual Input", /dev/input/event4, 
SPAM: getdevices.py, line 116, Found "Logitech MX Keys Mac", /dev/input/event3, usb-0000:02:00.0-4
SPAM: getdevices.py, line 116, Found "Logitech MX Master 3", /dev/input/event2, usb-0000:02:00.0-4
INFO: getdevices.py, line 179, Found "LogiOps Virtual Input", "Logitech MX Keys Mac"
DEBUG: presets.py, line 144, The newest preset is "Logitech MX Keys Mac", "new preset"
DEBUG: window.py, line 422, Selecting device "Logitech MX Keys Mac"
DEBUG: window.py, line 241, "Logitech MX Keys Mac" presets: "new preset"
DEBUG: window.py, line 469, Selecting preset "new preset"
INFO: mapping.py, line 139, Loading preset from "/home/claus/.config/key-mapper/presets/Logitech MX Keys Mac/new preset.json"
DEBUG: getdevices.py, line 93, Discovering device paths
SPAM: getdevices.py, line 116, Found "LogiOps Virtual Input", /dev/input/event4, 
SPAM: getdevices.py, line 116, Found "Logitech MX Keys Mac", /dev/input/event3, usb-0000:02:00.0-4
SPAM: getdevices.py, line 116, Found "Logitech MX Master 3", /dev/input/event2, usb-0000:02:00.0-4
INFO: getdevices.py, line 179, Found "LogiOps Virtual Input", "Logitech MX Keys Mac"
DEBUG: reader.py, line 119, Starting reading keycodes from "Logitech MX Keys Mac", "Logitech MX Master 3"

This did pop open the GUI, but I wasn't able to make any changes. Not sure how to proceed.

Systemd service fails on install

Installed key-mapper-git from the AUR.
Upon installation, the systemd service fails with:

Created symlink /etc/systemd/system/key-mapper.service → /usr/lib/systemd/system/key-mapper.service. 
Created symlink /etc/systemd/system/default.target.wants/key-mapper.service → /usr/lib/systemd/system/key-mapper.service. 
Job for key-mapper.service failed because the control process exited with error code. 
See "systemctl status key-mapper.service" and "journalctl -xe" for details. 
error: command failed to execute correctly 

The output of systemd status key-mapper is:

● key-mapper.service - Service to inject keycodes without the GUI application 
     Loaded: loaded (/usr/lib/systemd/system/key-mapper.service; enabled; vendor preset: disabled) 
     Active: failed (Result: exit-code) since Thu 2021-02-25 19:00:45 CET; 2min 12s ago 
   Main PID: 27336 (code=exited, status=1/FAILURE) 
 
feb 25 19:00:45 hyperversum key-mapper-service[27336]:     msg = msg % self.args 
feb 25 19:00:45 hyperversum key-mapper-service[27336]: TypeError: not all arguments converted during string formatting 
feb 25 19:00:45 hyperversum key-mapper-service[27336]: Call stack: 
feb 25 19:00:45 hyperversum key-mapper-service[27336]:   File "/usr/bin/key-mapper-service", line 66, in <module> 
feb 25 19:00:45 hyperversum key-mapper-service[27336]:     logger.error('Is the service is already running?', str(error)) 
feb 25 19:00:45 hyperversum key-mapper-service[27336]: Message: 'Is the service is already running?' 
feb 25 19:00:45 hyperversum key-mapper-service[27336]: Arguments: ('g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Connection ":1.90" is not allowed to own the service "keymapper.Control" due to security policies in the configuration file (9)',) 
feb 25 19:00:45 hyperversum systemd[1]: key-mapper.service: Main process exited, code=exited, status=1/FAILURE 
feb 25 19:00:45 hyperversum systemd[1]: key-mapper.service: Failed with result 'exit-code'. 
feb 25 19:00:45 hyperversum systemd[1]: Failed to start Service to inject keycodes without the GUI application. 

P.S. After rebooting, the service does not fail, but still gives the following warnings for the service:

● key-mapper.service - Service to inject keycodes without the GUI application
     Loaded: loaded (/usr/lib/systemd/system/key-mapper.service; enabled; vendor preset: disabled)
     Active: active (running) since Thu 2021-02-25 19:07:56 CET; 1min 6s ago
   Main PID: 312 (key-mapper-serv)
      Tasks: 3 (limit: 19042)
     Memory: 33.8M
     CGroup: /system.slice/key-mapper.service
             └─312 /usr/bin/python3 /usr/bin/key-mapper-service

feb 25 19:08:02 hyperversum key-mapper-service[312]: Request to autoload for "/dev/input/event11"
feb 25 19:08:02 hyperversum key-mapper-service[312]: ERROR: Tried to autoload /dev/input/event11 without configuring the daemon first via set_config_dir.
feb 25 19:08:03 hyperversum key-mapper-service[312]: Request to autoload for "/dev/input/event24"
feb 25 19:08:03 hyperversum key-mapper-service[312]: ERROR: Tried to autoload /dev/input/event24 without configuring the daemon first via set_config_dir.
feb 25 19:08:03 hyperversum key-mapper-service[312]: Request to autoload for "/dev/input/event25"
feb 25 19:08:03 hyperversum key-mapper-service[312]: ERROR: Tried to autoload /dev/input/event25 without configuring the daemon first via set_config_dir.
feb 25 19:08:03 hyperversum key-mapper-service[312]: Request to autoload for "/dev/input/event15"
feb 25 19:08:03 hyperversum key-mapper-service[312]: ERROR: Tried to autoload /dev/input/event15 without configuring the daemon first via set_config_dir.
feb 25 19:08:03 hyperversum key-mapper-service[312]: Request to autoload for "/dev/input/event16"
feb 25 19:08:03 hyperversum key-mapper-service[312]: ERROR: Tried to autoload /dev/input/event16 without configuring the daemon first via set_config_dir.

I have not done any configuration yet, but I would not except the service to throw errors before I even start and configure the mapper.

Razer basilisk V2 key not recognized "Razer Hypershift"

Dear all,

I have been trying the Razer Basilsik V2 with the software and I found the key "Razer Hypershift" is not recognized when you pressing it to bind the keys into the software.

If you need any debugger output I can get it.

BasiliskV2

Key Mapper can't map brightness keys

My keyboard has a very strange layout, which replaces the F keys with media controls despite Fn + F keys already being media controls. For certain keys, this program seems to work very well, but it doesn't appear to be able to pick up everything. F1 and F2 are monitor brightness up and down respectively, and key mapper can't read either one as inputs. Is there any workaround for this?

0.6.1 freezes the pointer when applying a profile

0.6.1 freezes the pointer when applying a profile, only way to restore the normal behaviour is unplugging and plugging it again. The profile doesn't work anyway. Console shows no error messages. 0.6.0 seems to be fine.

This is an excellent piece of software by the way. I hope it will arrive soon to every distro repo. Congratulations to the author.

Edit: I forgot to add the specs of my machine: Fedora 33 KDE on X11 with nvidia proprietary driver.

key-mapper.service fails

I'm on Ubuntu 20.10 and I downloaded key-mapper 0.60.

Excited about this program!

$ sudo systemctl status key-mapper.service

● key-mapper.service - Service to inject keycodes without the GUI application
     Loaded: loaded (/lib/systemd/system/key-mapper.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2021-01-10 18:26:57 EST; 13s ago
    Process: 5484 ExecStart=/usr/bin/key-mapper-service (code=exited, status=1/FAILURE)
   Main PID: 5484 (code=exited, status=1/FAILURE)

Jan 10 18:26:57 notebook key-mapper-service[5484]:   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
Jan 10 18:26:57 notebook key-mapper-service[5484]:   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
Jan 10 18:26:57 notebook key-mapper-service[5484]:   File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
Jan 10 18:26:57 notebook key-mapper-service[5484]:   File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
Jan 10 18:26:57 notebook key-mapper-service[5484]:   File "<frozen zipimport>", line 259, in load_module
Jan 10 18:26:57 notebook key-mapper-service[5484]:   File "/usr/local/lib/python3.8/dist-packages/evdev-1.3.0-py3.8-linux-x86_64.egg/evdev/ecodes.py", line 77, in <module>
Jan 10 18:26:57 notebook key-mapper-service[5484]: NameError: name 'BTN' is not defined
Jan 10 18:26:57 notebook systemd[1]: key-mapper.service: Main process exited, code=exited, status=1/FAILURE
Jan 10 18:26:57 notebook systemd[1]: key-mapper.service: Failed with result 'exit-code'.
Jan 10 18:26:57 notebook systemd[1]: Failed to start Service to inject keycodes without the GUI application.

Mouse compatibility

Now that you've added button 6 & 7 I'm looking at a new trackball like an Elecom that has those buttons. Does your software work with basically any mouse or should I just stick with Logitech?

Jim

AUR package isn't working

Just used key-mapper-git from AUR.

⠄⠘⣿⣿⣿⣿⣿⣿⣿⣿⠄⣴⣿⣶⣄⠄⣴⣶⠄⢀⣾⣿⣿⣿⣿⣿⣿⠃⠄⠄   Software Information 
⠄⠄⠈⠻⣿⣿⣿⣿⣿⣿⡄⢻⣿⣿⣿⠄⣿⣿⡀⣾⣿⣿⣿⣿⣛⠛⠁⠄⠄⠄     Linux 5.9.3-95-tkg-pds 
⠄⠄⠄⠄⠈⠛⢿⣿⣿⣿⠁⠞⢿⣿⣿⡄⢿⣿⡇⣸⣿⣿⠿⠛⠁⠄⠄⠄⠄⠄     Manjaro Linux x86_64 
⠄⠄⠄⠄⠄⠄⠄⠉⠻⣿⣿⣾⣦⡙⠻⣷⣾⣿⠃⠿⠋⠁⠄⠄⠄⠄⠄⢀⣠⣴     Plasma 5.20.3 
⣿⣿⣿⣶⣶⣮⣥⣒⠲⢮⣝⡿⣿⣿⡆⣿⡿⠃⠄⠄⠄⠄⠄⠄⠄⣠⣴⣿⣿⣿   >_ zsh 5.8 


└─(12:11:25)──> key-mapper-gtk                                                                                                                                                                                                               
Gtk-Message: 12:11:32.090: Failed to load module "appmenu-gtk-module"
Loaded config from "/home/casual/.config/key-mapper/config"
Traceback (most recent call last):
  File "/usr/bin/key-mapper-gtk", line 41, in <module>
    install(show_locals=True)
TypeError: install() got an unexpected keyword argument 'show_locals'

Is there any way to quickly switch between mappings (via cli, etc) or to have conditional mapping applied?

Hey there,
I am wondering if there is any way to quickly switch between mappings or to have conditional mapping? An example being, if I were to somehow monitor my currently focused window (perhaps AutoKey, or some other application that runs in the background?) and it is detected that I have VSCode focused, apply X mapping to the mouse, if anything else is focused, go back to default, or some other mapping.

The reason being, I want to use Middle Mouse in VSCode to "jump to definition" as it does in Jetbrains IDE's, but VSCode doesn't allow you to bind the mouse, (or at least, it doesn't work right) but I want the middle mouse to function as it does in say, Firefox or other application as it normally would for closing tabs or scrolling.

I am able to do this just fine on Windows using AutoHotKey (though, with AHK, I was able to change functionality not only based on window focus, but also current mouse position within the current window), but unfortunately, I have yet to be able to find a way to do it on Linux. This seems like it might be able to do it if I can switch between mappings when needed.

Thanks,
-MH

AUR still broken

I've rebuilded package and again got errors:


└─(18:17:59 on main)──> key-mapper-service                                                                                                                                                                                                   
Loaded config from "/home/casual/.config/key-mapper/config"
Logging to "/home/casual/.log/key-mapper/log"
0.2.0 key-mapper
Traceback (most recent call last):
  File "/usr/bin/key-mapper-service", line 61, in <module>
    can_read_devices()
  File "/usr/lib/python3.8/site-packages/keymapper/dev/permissions.py", line 37, in can_read_devices
    is_plugdev = USER in grp.getgrnam('plugdev').gr_mem
KeyError: "getgrnam(): name not found: 'plugdev'"

└─(18:18:02 on main)──> key-mapper-gtk                                                                                                                                                                                                   
Gtk-Message: 18:18:05.436: Failed to load module "appmenu-gtk-module"
Loaded config from "/home/casual/.config/key-mapper/config"
0.2.0 key-mapper
WARNING: The daemon "key-mapper-service" is not running, mapping keys only works as long as the window is open.
Traceback (most recent call last):
  File "/usr/bin/key-mapper-gtk", line 59, in <module>
    window = Window()
  File "/usr/lib/python3.8/site-packages/keymapper/gtk/window.py", line 112, in __init__
    permitted, _, is_input, is_plugdev, can_write = can_read_devices()
  File "/usr/lib/python3.8/site-packages/keymapper/dev/permissions.py", line 37, in can_read_devices
    is_plugdev = USER in grp.getgrnam('plugdev').gr_mem
KeyError: "getgrnam(): name not found: 'plugdev'"

Doing same thing with 'sudo' - same result.

Can't remap/detect side wheel buttons

Key-mapper can't detect left wheel/ right wheel direction (REL_HWHEEL i think) i have caputre the result of evtest for each of my devices, with 2 key input each time, first left mouse wheel then right mouse wheel :

Same result for the 3 devices:
Testing ... (interrupt to exit) Event: time 1609584164.206483, type 2 (EV_REL), code 6 (REL_HWHEEL), value -1 Event: time 1609584164.206483, type 2 (EV_REL), code 12 (REL_HWHEEL_HI_RES), value -120 Event: time 1609584164.206483, -------------- SYN_REPORT ------------ Event: time 1609584166.638449, type 2 (EV_REL), code 6 (REL_HWHEEL), value 1 Event: time 1609584166.638449, type 2 (EV_REL), code 12 (REL_HWHEEL_HI_RES), value 120 Event: time 1609584166.638449, -------------- SYN_REPORT ------------

GUI unresponsive

I'm trying to set up my keyboard where holding capslock and typing h, j, k, or l will move left, down, up, or right as in vim. The only way I can think to do this is with a custom shortcut like alt-control-h. Is there a way to assign multiple modifiers to a key like alt-control to capslock?

Alternatively, is there a way to create a unique modifier key to use for something like this?

key_f13 -> key_f24 seem to be incorrect

I usually try to map mouse buttons to f13 -> f24 since they are pretty much unused, but using key_f13 does not provide a valid f13 for the games that normally accept f13 without problems (tried World of Warcraft and Minecraft).

I tried the same with key_f2 rather than the normal f2 mapping and it has the same issue. I'm not sure if mappings with "key_" are meant to be different, but they seem to be different at least for games.

So would it be possible to get similar mappings as f1 -> f12, for f13 -> f24 (aka where there isn't a "key_" prefix)?

Best regards,
Mauritz

Automatic reapplying mappings on device reconnect

Hello!

When I unplug and "replug" a device that has a set mapping I need to manually open key-mapper and click apply on the custom mapping for said device. Is it possible that this would happen automatically?

Feature: Duplicate Preset

It would be nice to be able to duplicate presets, so one wouldn't have to enter everything again, if the new preset should only have slight changes.

It could be implemented as a button next to new. A disadvantage might be that it could become too clustered.

Authentication method doens't work on main.

I'm on Fedora 33 Plasma 5.21. Now key-mapper from master doesn't show the graphical tool for authenticating. When running key-mapper-gtk-pkexec it shows a password prompt, but after entering the password it gives an error and key-mapper terminates

key-mapper-gtk-pkexec
==== AUTHENTICATING FOR keymapper ====
Authentication is required to discover and read devices.
Authenticating as: xxxxxx
Password: 
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ====
Error executing command as another user: Not authorized

This incident has been reported.

Tartarus v2 key button stuck/repeats (Manjaro, OpenRazer)

I just installed key-mapper and it's everything I could've wanted, thank you!

However, I found that when mapping say the BTN_MIDDLE on my Tartarus v2 to control_l+v, it keeps both keys pressed. (So it keeps pasting my clipboard)
It seems as if 'is_key_up' is not triggered.

The specific behaviour is as follows:
I press BTN_MIDDLE on the Tartarus v2, it pastes my clipboard (control_l+v), and for let's say, 200-300ms that's it.
Then it just goes ahead and spam pastes the clipboard, non-stop, until I unplug the Tartarus v2.
After unplugging the Tartarus v2 it keeps pasting for a little while longer and then finally stops.

I'm not sure, with the short time I've looked at the code, specifically around keycode_mapper.py, if the issue/bug is with the code or my Manjaro/OpenRazer installation. (Both up-to-date as of this submission)

Other than that it works wonders and this is not a major issue for me. 👍

Automatically loading for bluetooth devices

I've mapped some keys in your app, named, saved and applied the settings with autoload enabled, but after restarting Ubuntu the mapped keys stop working. key-mapper-autoload is enabled in the autostart settings of Ubuntu.

How to debug this?

I'm using v0.6.0 installed with .deb on Ubuntu 20.10 with Xorg.

_gtk_style_provider_private_get_settings assertion failed

I started the service and did the stuff with sudo (doas)..
It aint working...

I've attached details


Arch Linux x86_64
5.10.11-arch1-1
GNOME 3.38.3


No protocol specified
Unable to init server: Could not connect: Connection refused
No protocol specified
Unable to init server: Could not connect: Connection refused
Loaded config from "/home/faulty/.config/key-mapper/config.json"
0.78284 DEBUG: logger.py, line 181, Using rich.traceback
0.81042 INFO: logger.py, line 152, key-mapper 0.6.0
0.81116 INFO: logger.py, line 155, python-evdev 1.4.0
0.81126 WARNING: logger.py, line 161, Debug level will log all your keystrokes! Do not post this output in the internet if you typed in sensitive or private information with your device!
0.81139 DEBUG: logger.py, line 167, pid 28879
0.85933 DEBUG: data.py, line 85, Found data at "/usr/share/key-mapper"

(key-mapper-gtk:28879): Gtk-CRITICAL **: 16:33:37.282: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(key-mapper-gtk:28879): Gtk-CRITICAL **: 16:33:37.282: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(key-mapper-gtk:28879): Gtk-CRITICAL **: 16:33:37.282: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
Segmentation fault (core dumped)

Hypershift button for mouse Razer Basilisk V2

Hi,
Previously we was talking about the Hypershift button. And there is an event as you can see en in the screenshot. I choose the event10 and pushing only the hypershift button. Clarify there is a small button below on the mouse which have three profiles. Let me know if you have something more.

Ima1
Ima2

[Feature Request]: presets assigned to programs

Would be lovely if you could mark a preset as default and then have others that would activate when you focus a specific program/game.

Not sure if this is already planned or if this would just be a giant pain to add... But thought I should at least put it out there

Best regards,
Mauritz

Dark theme no longer loading

I am on Manjaro 20.2 GNOME running the 5.9.1-1-rt19-MANJARO kernel.

I use key-mapper-git 0.4.0-1 from the AUR.

The version I had installed prior to 0.4.0-1 (unfortunately I don't remember which version that was exactly) was respecting the dark theme I am using (Prof-Gnome-Dark-3.6) and in consequence rendered its UI in dark mode. The new version 0.4.0-1 does render with a bright theme which I consider a bug. :)

When to update the software release

I'm running v 0.5.0 and it's doing a fine job of inputting the keystrokes for mouse button 2, 6 and 7. Thanks again for you help in getting button 6 & 7 working. Now I see your up to v 0.6.0

I don't see me adding additional key and mapping statements to add functionality to the installed software at least at this time. Do you feel that it's necessary that I keep up with new releases as you publish them if the three buttons are working correctly?

Jim

Drawing tablet cursor not moving if stylus button mapped

Hi, when trying to apply a profile on a drawing tablet, key-mapper starts to make the tablet behave like a relative device. This should be changed in order to be able to use this software to remap buttons on a drawing tablet and its pencil. Thanks in advance.

3 parameter macro

I'm trying to use three parameters ( control_l + alt_l + down ) to be assigned to a mouse button but I see errors in my syntax saying only two are allowed. I must not be understanding how to do this correctly. Just saw that there is a new version 0.6.0 released and I'm on version 0.5.0.

Super Key

I'm using an Apple keyboard and I'm unable to bind the left Super key. The right Super key will bind, oddly. I hit "click here" for the button I want to bind, but when I hit the left Super key it won't register. It looks like the only button that won't work.

EDIT: I got this working, it was some kind of conflict with Tweaks. My only remaining issue is sometimes the all my keys wig out and nothing works, even my mouse, and I have to log out and log back in and then it's fine.

Fail to start, installed from AUR

Hey there. Installed from the AUR. Starting the program gives:

key-mapper 0.6.1
python-evdev 1.4.0
Creating file "/home/kimoli/.config/key-mapper/config.json"
Traceback (most recent call last):
File "/usr/bin/key-mapper-gtk", line 53, in <module>
from keymapper.gui.window import Window
File "/usr/lib/python3.9/site-packages/keymapper/gui/window.py", line 31, in <module>
from keymapper.state import custom_mapping
File "/usr/lib/python3.9/site-packages/keymapper/state.py", line 32, in <module>
from keymapper.mapping import Mapping, DISABLE_NAME, DISABLE_CODE
File "/usr/lib/python3.9/site-packages/keymapper/mapping.py", line 31, in <module>
from keymapper.config import ConfigBase, config
File "/usr/lib/python3.9/site-packages/keymapper/config.py", line 271, in <module>
config = GlobalConfig()
File "/usr/lib/python3.9/site-packages/keymapper/config.py", line 192, in __init__
self.load_config()
File "/usr/lib/python3.9/site-packages/keymapper/config.py", line 242, in load_config
self.save_config()
File "/usr/lib/python3.9/site-packages/keymapper/config.py", line 262, in save_config
touch(self.path)
File "/usr/lib/python3.9/site-packages/keymapper/paths.py", line 83, in touch
shutil.chown(path, USER, USER)
File "/usr/lib/python3.9/shutil.py", line 1312, in chown
raise LookupError("no such group: {!r}".format(group))
LookupError: no such group: 'kimoli'
03:02:22 PM   >> $ whoami
kimoli

Trying again leads to:

key-mapper 0.6.1
python-evdev 1.4.0
ERROR: Failed to parse config "/home/kimoli/.config/key-mapper/config.json": Expecting value: line 1 column 1 (char 0)

config.json is an empty file. Deleting it causes the first error, which then goes on to the second error when running again.

[Feature Request] Add support for left key remapping

I've just noticed that key-mapper can't remap left button, it doesn't get detected on the correspondent box when you press it.

Being able to remap left button would be useful for the following use cases:

  • Models like Kensington Slimblade and Expert trackballs.
  • Just for lefties on normal mices
  • Using the left button as part of some key combinations.

Thanks in advance.

v0.7.0 using Key + Key vs macros

Ubuntu uses the super key and the page up or page down to scroll thru workspaces. If I use the macro the scrolling works really nice. Ubuntu's keyboard mapping uses to scroll through the workspaces 'Super+Page Up or Super+Page Down' and xev reports the Page Up key = Prior and the Page Down key = Next.
The working macro looks like this:
REL_HWHEEL R m(super_l, k(next))
REL_HWHEEL L m(super_l, k(prior))

If I try using the new key + key syntax I don't get the same scrolling through the workspaces.
REL_HWHEEL R super_l + next
REL_HWHEEL L super_l + prior
When I press the mouse button (R) one workspace is scrolled down, a slight pause, then the scrolling continues all the way to the last workspace and the scrolling stops working if the left or right button is pressed. Am I using the syntax incorrectly?

Jim

Mappings not autoloaded

I love this app! Thanks for making it! <3

I am on Manjaro 20.2 GNOME running the 5.9.1-1-rt19-MANJARO kernel.

I use key-mapper-git 0.4.0-1 from the AUR.

My mappings only work after performing the following steps:

  1. Launch key-mapper-gtk
  2. Press "Save"
  3. Press "Apply"

However, as soon as I close the GUI the mappings stop to work.

"Autoload" is activated but when rebooting the mappings do not work.

I ran sudo usermod -a -G input $USER already with no effect.

I also tried sudo key-mapper-service --setup-permissions but get: error: unrecognized arguments: --setup-permissions in return.

Many thanks for your help!

Best

Amadeus

20.04 internal error

I installed Ubuntu 20.04 and recently and I'm getting a system error shortly after logging in and when I look at the error it references Key-mapper. The version I'm running is 0.7.0 which I downloaded on 2/25/21. I could try not auto starting your program and starting it after a few minutes after I log in. Do you have any other tests you'd like me to try. I started installing 20.04 and several programs about 7-8 days ago. Key-Mapper was one of the first ones installed and I didn't start getting this error until a 3-4 days ago. The errors started sporadically but the last couple days it occurs every time I boot my computer and a few minutes after I log in and after I close the error I don't get another one the rest of the time my laptop is on.

Ubuntu_005

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.