GithubHelp home page GithubHelp logo

evremap's Introduction

evremap

A keyboard input remapper for Linux/Wayland systems, written by @wez

Why?

I couldn't find a good solution for the following:

  • Remap the CAPSLOCK key so that it produces CTRL when held, but ESC if tapped
  • Remap N keys to M keys. Eg: F3 -> CTRL+c, and ALT+LEFT to HOME

How?

evremap works by grabbing exclusive access to an input device and maintaining a model of the keys that are pressed. It then applies your remapping configuration to produce the effective set of pressed keys and emits appropriate changes to a virtual output device.

Because evremap targets the evdev layer of libinput, its remapping is effective system-wide: in Wayland, X11 and the linux console.

Configuration

Here's an example configuration that makes capslock useful:

# The name of the device to remap.
# Run `sudo evremap list-devices` to see the devices available
# on your system.
device_name = "AT Translated Set 2 keyboard"

# If you have multiple devices with the same name, you can optionally
# specify the `phys` value that is printed by the `list-devices` subcommand
# phys = "usb-0000:07:00.3-2.1.1/input0"

# Configure CAPSLOCK as a Dual Role key.
# Holding it produces LEFTCTRL, but tapping it
# will produce ESC.
# Both `tap` and `hold` can expand to multiple output keys.
[[dual_role]]
input = "KEY_CAPSLOCK"
hold = ["KEY_LEFTCTRL"]
tap = ["KEY_ESC"]

You can also express simple remapping entries:

# This config snippet is useful if your keyboard has an arrow
# cluster, but doesn't have page up, page down, home or end
# keys.  Here we're configuring ALT+arrow to map to those functions.
[[remap]]
input = ["KEY_LEFTALT", "KEY_UP"]
output = ["KEY_PAGEUP"]

[[remap]]
input = ["KEY_LEFTALT", "KEY_DOWN"]
output = ["KEY_PAGEDOWN"]

[[remap]]
input = ["KEY_LEFTALT", "KEY_LEFT"]
output = ["KEY_HOME"]

[[remap]]
input = ["KEY_LEFTALT", "KEY_RIGHT"]
output = ["KEY_END"]

When applying remapping configuration, ordering is important:

  • Dual Role entries are always processed first
  • Remap entries are applied in the order that they appear in your configuration file

Here's an example where ordering is important: on the PixelBook Go keyboard, the function key row has alternate functions on the keycaps. It is natural to want the mute button to mute by default, but to emit the F8 key when holding alt. We can express that with the following configuration:

[[remap]]
input = ["KEY_LEFTALT", "KEY_F8"]
# When our `input` is matched, our list of `output` is prevented from
# matching as the `input` of subsequent rules.
output = ["KEY_F8"]

[[remap]]
input = ["KEY_F8"]
output = ["KEY_MUTE"]
  • How do I list available input devices? sudo evremap list-devices

  • How do I list available key codes? evremap list-keys

Building it

$ sudo dnf install libevdev-devel # redhat/centos
## or
$ sudo apt install libevdev-dev # debian/ubuntu

$ cargo build --release

Running it

To run the remapper, invoke it as root (so that it can grab exclusive access to the input device):

$ sudo target/release/evremap remap my-config-file.toml

Or, grant an unprivileged user access to evdev and uinput. On Ubuntu, this can be configured by running the following commands and rebooting:

sudo gpasswd -a YOUR_USER input
echo 'KERNEL=="uinput", GROUP="input"' | sudo tee /etc/udev/rules.d/input.rules

For some platforms, you might need to create an input group first and run:

echo 'KERNEL=="event*", NAME="input/%k", MODE="660", GROUP="input"' | sudo tee /etc/udev/rules.d/input.rules

as well.

Systemd

A sample system service unit is included in the repo. You'll want to adjust the paths to match your system and then install and enable it:

$ sudo cp evremap.service /usr/lib/systemd/system/
$ sudo systemctl daemon-reload
$ sudo systemctl enable evremap.service
$ sudo systemctl start evremap.service

Runit

If you're using Runit instead of Systemd, follow these steps to create a service.

  • Create a directory called evremap and create a file called run under it
sudo mkdir /etc/sv/evremap
sudo touch /etc/sv/evremap/run
  • Copy these lines into the run file
#!/bin/sh
set -e 
exec <PATH_TO_EVREMAP> remap <CONFIG>

Replace <PATH_TO_EVREMAP> with the path to your evremap executable and <CONFIG> with the path to your configuration file.

  • Finally, symlink the evremap directory to /var/service
sudo ln -s /etc/sv/evremap /var/service

OpenRC

To make an OpenRC service, create the file /etc/init.d/evremap with the following contents...

#!/usr/bin/openrc-run

supervisor=supervise-daemon
command="<PATH_TO_EVREMAP>"
command_args="remap <CONFIG>"

Replace <PATH_TO_EVREMAP> with the path to your evremap executable and <CONFIG> with the path to your configuration file.

Make the file executable...

chmod +x /etc/init.d/evremap

Enable the service with...

rc-update add evremap

Start the service with...

rc-service evremap start

How do I make this execute a command when a key is pressed?

That feature is not implemented.

evremap's People

Contributors

and3rson avatar grimm26 avatar haileys avatar hrmitrev avatar leo-mathguy avatar lilly-lizard avatar matklad avatar nat-418 avatar nate-sys avatar rmsyn avatar wez 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

evremap's Issues

[question] how to properly re-map `fn+rightctrl` to `context_menu`?

Thank you for this tool!

Lenovo removed the context menu key 😢. See: https://askubuntu.com/questions/234416/how-to-remap-the-context-menu-to-another-key-in-linux.

I'm trying to remap function + right control, key combination, to open right click context menu. But it does not seem to work. Here's my setup:

$ which evremap
/usr/bin/evremap

$ evremap --version          
evremap 0.1.0

$ sudo evremap list-devices | rg 'keyboard'
Name: AT Translated Set 2 keyboard

$ sudo evremap list-keys | rg 'CONTEXT'   
KEY_CONTEXT_MENU

$ sudo evremap list-keys | rg 'MENU'   
KEY_CONTEXT_MENU
KEY_MEDIA_TOP_MENU
KEY_MENU
KEY_ROOT_MENU

$ sudo evremap list-keys | rg 'FN$' 
KEY_FN

$ sudo evremap list-keys | rg 'CTRL'     
KEY_LEFTCTRL
KEY_RIGHTCTRL

and /etc/evremap.toml

device_name = "AT Translated Set 2 keyboard"

[[remap]]
input = ["KEY_FN", "KEY_RIGHTCTRL"]
output = ["KEY_CONTEXT_MENU"]

but when running the tool

$ sudo /usr/bin/evremap remap /etc/evremap.toml
 2023-11-01T22:31:01.958 WARN  evremap > Short delay: release any keys now!
 2023-11-01T22:31:04.409 INFO  evremap::remapper > Going into read loop
^C

All the other keyboard shortcuts (alt+tab, switch windows) glitch and the context menu does not appear on pressing the re-mapped key combination. How do I resolve this?

Feature request: execute command on keypress

I've been looking for a lightweight input remapper. You project is absolutely amazing, it's so efficient and so easy to work with.

I created a forked version of the project. I added the ability to execute command using a hotkey. In my case, that's the command to logout from gnome session (to be used in case of GPU hang). Here's link to my forked version: https://github.com/ngxson/hobby-evremap/blob/master/src/remapper.rs#L446

However, since I don't have much knowledge about rust, I can only hard-code the command. It would be nice to have an option in the toml file.

Keyboard and mouse combo remap

There is imwheel tool for X11, that allows you to remap mouse wheel events combined with keyboard modifiers. I am looking for this functionality on wayland.

The problem is that afaik, this tool (evremap) currently only allow you to map a single device, while thing that I want requires two devices.

This works (remaps mouse button):

device_name = "Logitech MX Master"

[[remap]]
input = ["BTN_RIGHT"]
output = ["KEY_PAGEUP"]

This also works (remaps keyboard combination):

device_name = "Logitech K850"

[[remap]]
input = ["KEY_LEFTALT", "KEY_UP"]
output = ["KEY_PAGEUP"]

But such thing does not work:

device_name = ["Logitech MX Master", "Logitech K850"]

[[remap]]
input = ["KEY_LEFTALT", "BTN_RIGHT"]
output = ["KEY_PAGEUP"]

because device_name is expected to be a string.
Can we hope such functionality will be implemented?

Feature request: Support waiting for keyboard to be connected

I have evremap set up for my bluetooth keyboard which is sometimes not connected at all. So, systemd ends up restarting evremap once a couple of seconds which ends up increasing PIDs on my entire system after some time. I think this is not ideal and some mechanism for waiting on connection could be good?

ERROR evremap::remapper > Going into read loop

hey this project looks great!
But, I've tried a few remaps and things are not working

this is my config:

# Run `sudo evremap list-devices` to see the devices available
# on your system.
device_name = "BT5.0 KB Keyboard"

[[remap]]
input = ["KEY_LEFTALT", "KEY_BACKSPACE"]
output = ["KEY_DELETE"]

and this was the command and output ( my config file is inside the repo)

evremap [ master][!?][📦 v0.1.0][🦀 v1.69.0]                                 Sat, May 13, 2023 | 00:31
❯ sudo ./target/release/evremap remap ./config.toml
 2023-05-13T00:33:42.354 ERROR evremap > Short delay: release any keys now!
 2023-05-13T00:33:44.645 ERROR evremap::remapper > Going into read loop

and that's my machine:
image

pls let me know if I can be of help, or if I am doing something wrong

Add Hyper_L

Would it be possible to add Hyper_L?
I would like to use Hyper as Mod3 in Sway.

Something like:

[[dual_role]]
input = "KEY_CAPSLOCK"
hold = ["KEY_LEFTHYPER"]
tap = ["KEY_ESC"]

hibernation support

currently i have to disconnect my external keyboard after rebooting from a hibernated state

Feature request: sequences

It would be good to add a [[sequence]] type of binding where rather than chords of keys (eg. KEY_LEFTCTRL and KEY_F24) being pressed at once, sequences of keys pressed one after the other (eg. KEY_LEFTCTRL and then KEY_F24) can be used as valid values for input or output. This would allow both for the recording of simple macros as well as for more (the number of possible mappings is vastly increased) and ergonomically improved (no Emacs pinky) key mappings.

I don't know Rust, but I will try and take time to see if I can hack this together. Might be better implemented as a non-hack, however.

Not working properly in Sway + XKB

Hi,

I am using Sway and XKB to switch between my keyboard layouts (TH and US).
This had been working out of the box since I installed Sway on my laptop until I ran evremap.

This is the XKB configuration part of my Sway configuration:

input "1:1:AT_Translated_Set_2_keyboard" {
    xkb_layout us,th
    xkb_model pc105
    xkb_options grp:alt_space_toggle
}

As you can see, Alt+Space is supposed to change my keyboard layout.

And here is my evremap config (whole file):

device_name = "AT Translated Set 2 keyboard"

[[dual_role]]
input = "KEY_SYSRQ"
hold = ["KEY_RIGHTMETA"]
tap = ["KEY_PRINT"]

The remap works. But whenever I start evremap.service, the xkb toggle stops working.
The toggle starts working again if I stop evremap.service.
I thought this was a common problem, but after searching in Issues, I don't see others similar to this.

I would appreciate any helps, thank you very much!

cant remap CAPSLOCK to FN

this is my current config

phys = "5c:c9:d3:7d:6d:0f"

[[remap]]
input = ["KEY_CAPSLOCK"]
output = ["KEY_FN"]

i need FN combinations for several commands such as fn + } = END, which is how my keyb works,
but the remap as it is only removes the capslock function of the capslock key, without adding the fn funcion

have you got an idea of what could be the problem?

Cannot remap keys on Cherry keyboard

I cannot remap keys on my Cherry Wired Keyboard. evremap config.toml does not ouput an error message, but does not have any effect. evremap list-devices shows two devices named "Cherry GmbH CHERRY Wired Keyboard' with two different events. I have no clue what is the right event for the keyboard, but maybe evremap takes the wrong one. The keyboard name seems to be ambiguous.

I have another keyboard, the Logitech K380 bluetooth keyboard, which has three devices. But these devices have three different names, "Keyboard K380 Keyboard", "Keyboard K380 System Control" and "Keyboard K380 Consumer Control", and taking the first one works.

Double-tap event

What would be the viability (with the current implementation)
of enabling an additional "double-tap" role in addition to
the current "hold" vs "tap" mappings?

evremap (systemd service) does not start if the device its trying to remap is not connected

So, I have a TV remote, which is connected over a USB 2.4GHz dongle, and the remote does not have some important keys such as Shift, Control, Alt, Tab and Meta. So I use evremap to map these keys to the keys that are on the remote. The remote is plugged into the dock for my laptop - meaning, its only connected to my laptop when I am home. However, a laptop is still, very obviously, a laptop, so its not out of ordinary for it to be turned on when i am on the go - like, on a lecture in the university or something. And if the laptop is turned on elsewhere and then I get back home, the mappings do not work, because at the time of startup evremap's systemd service did not see the remote's usb dongle and emulated input devices plugged in.

This can happen with any scenario when any laptop is connected to an input device, but not permanently: people who use their Thinkpads as workstations when they are home (like me), people who sometimes connect a USB keyboard for some couch gaming, people who try to use evremap with bluetooth input methods and their bluetooth input method just ran out of battery or wasn't on when their computer was starting, etc.

There should be some built in way to wait for the needed device to connect, IMHO. For a convenience tool that evremap is, making it more convenient is only better, right?

Can't make it work

Cannot make it run under Archlinux.

my config:

device_name = "AT Translated Set 2 keyboard"

[[remap]]
input = ["KEY_LEFTCTRL"]
output = ["KEY_CAPSLOCK"]

[[remap]]
input = ["KEY_CAPSLOCK"]
output = ["KEY_LEFTCTRL"]

Running the command

sudo evremap remap ./code-kbd.conf 
 2022-03-12T23:47:49.075 ERROR evremap > Short delay: release any keys now!
Error: creating UInputDevice from /dev/input/event3

Caused by:
    ENODEV: No such device

List of devices:

sudo evremap list-devices           
Name: AT Translated Set 2 keyboard
Path: /dev/input/event3
Phys: isa0060/serio0/input0

Name: HDA Intel PCH Dock Headphone
Path: /dev/input/event9
Phys: ALSA

Name: HDA Intel PCH Dock Mic
Path: /dev/input/event7
Phys: ALSA

Name: HDA Intel PCH HDMI/DP,pcm=10
Path: /dev/input/event15
Phys: ALSA

Name: HDA Intel PCH HDMI/DP,pcm=3
Path: /dev/input/event11
Phys: ALSA

Name: HDA Intel PCH HDMI/DP,pcm=7
Path: /dev/input/event12
Phys: ALSA

Name: HDA Intel PCH HDMI/DP,pcm=8
Path: /dev/input/event13
Phys: ALSA

Name: HDA Intel PCH HDMI/DP,pcm=9
Path: /dev/input/event14
Phys: ALSA

Name: HDA Intel PCH Headphone
Path: /dev/input/event10
Phys: ALSA

Name: HDA Intel PCH Mic
Path: /dev/input/event8
Phys: ALSA

Name: Lid Switch
Path: /dev/input/event0
Phys: PNP0C0D/button/input0

Name: PC Speaker
Path: /dev/input/event4
Phys: isa0061/input0

Name: Power Button
Path: /dev/input/event2
Phys: LNXPWRBN/button/input0

Name: Sleep Button
Path: /dev/input/event1
Phys: PNP0C0E/button/input0

Name: SynPS/2 Synaptics TouchPad
Path: /dev/input/event16
Phys: isa0060/serio1/input0

Name: TPPS/2 IBM TrackPoint
Path: /dev/input/event17
Phys: synaptics-pt/serio0/input0

Name: ThinkPad Extra Buttons
Path: /dev/input/event6
Phys: thinkpad_acpi/input0

Name: Video Bus
Path: /dev/input/event5
Phys: LNXVIDEO/video/input0

Any idea what's going wrong?

Remapping KEY_RFKILL doesn't seem to work

I'm trying to disable my airplane mode key on my keyboard, and remap it to the right arrow key. I have tried:

[[remap]]
input = ["KEY_RFKILL"]
output = ["KEY_RIGHT"]

and

[[dual_role]]
input = "KEY_RFKILL"
hold = ["KEY_RIGHT"]
tap = ["KEY_RIGHT"]

Neither one works, but other keys are able to be remapped just fine. According to evremap list-keys, this should be a valid remapping.

Running rfkill list indicates that the airplane mode key causes the wifi to only be soft blocked, so it should be able to be remapped. When I run xev, the airplane mode key corresponds to XF86RFKILL (keycode 255). If I do something like xmodmap -e "keycode 255 = Right", the key still turns off and on my wifi, while also functioning as a right arrow key, which is not what I want. My OS is Garuda Linux with Qtile, which is Arch-based. Any help would be appreciated.

Combos also press the individual keys

Hello, your code here looks right up the alley of what I'm looking for, but I've noticed some unexpected behavior as I'm trying it out, wondering if I'm just doing something wrong. Here's my config (minus the device name):

[[remap]]
input=["KEY_A", "KEY_S"]
output = ["KEY_N"]

Every time I hit the combo, I get not only an n, but also an s or an a. I was expecting/hoping to just get the n. Is this an expected behavior? If so, I might take the time to dig in and see if I can resolve that at least for my own use, and I'm happy to submit a PR for it if you would like.

.tomf or .conf for the systemd service?

I nearly went insane because I couldn't understand where to put my config that I ran with the normal evremap remap command (no systemd). Might be possible that both .conf and .tomf work, but when I personally tried to export my text file as a .tomf it didn't work. So maybe adjust the ExecStart line in the .service file to ExecStart=bash -c "/usr/bin/evremap remap /etc/evremap.conf -d 0"

No way to access keys absent from keyboard

I'm using a keyboard with a UK physical layout, but I'm using another (Swiss) layout. The physical key for 'baskslash' doesn't exist on my keyboard (as with my Swiss layout, the resuling key is mapped to the $ sign). I wanted to use evremap to regain access to the backslash symbol by mapping an unused key to it.
I tried mapping an unused key to KEY_BACKSLASH, but that actually maps the key to the $ sign. I also can't find the angle brackets (less/grater than) in the evremap list-keys command, I suspect that is because they're located on the same key as where by backslash would be, and so I can't access them. Am I right to assume I can't get what I want with evremap?

Not necessary to run as root

Hey, thanks for evremap. Just wanted to let you know that it is not necessary to run evremap as root, and I think this could allow the feature of evremap to handle sending commands as well. On my system I run evremap as an unprivileged user like so:

sudo gpasswd -a YOUR_USER input
echo 'KERNEL=="uinput", GROUP="input"' | sudo tee /etc/udev/rules.d/input.rules

I would propose adding these optional steps to the README and allowing the user to define commands on keypress. For me this means not needing another program like swhkd or AutoKey to do that.

Swap keys

Wonderful utility! Could we add a function to swap keys that doesn't cause loops, i.e. swap KEY_CAPSLOCK and KEY_LEFTCTRL.

For example, I'd like the physical CAPSLOCK key to do the dual_role, and the physical LEFTCTRL to emit CAPSLOCK.

This doesn't work as intended:

[[dual_role]]
input = "KEY_CAPSLOCK"
hold = ["KEY_LEFTCTRL"]
tap = ["KEY_ESC"]

[[remap]]
input = ["KEY_LEFTCTRL"]
output = ["KEY_CAPSLOCK"]

I understand I can do something like:

[[dual_role]]
input = "KEY_CAPSLOCK"
hold = ["KEY_LEFTCTRL"]
tap = ["KEY_ESC"]

[[dual_role]]
input = "KEY_LEFTCTRL"
hold = ["KEY_LEFTCTRL"]
tap = ["KEY_CAPSLOCK"]

But I can still see some use case for a real swapping. Perhaps a way to specify the original "physical" key?

fails to start with exit code status=127 #issue

Cannot get evremap to run as a service or from the terminal.

terminal

running sudo target/release/evremap remap /etc/evremap.toml from the terminal gives output

WARN  evremap > Short delay: release any keys now!
INFO  evremap::remapper > Going into read loop

but has no tangible effect.

systemctl

sudo systemctl start evremap.service Gives on immediate error
but systemctl status evremap.service reports
Active: failed
and
(code=exited, status=127)
(more detail in [[[issue]])

Environment

lenovo laptop
arch / wayland / hyperland
Systemd 255 (255.2-2-arch)

my progress log

Fair warning I'm still quite new to Linux and especially arch, used pop os for awhile but that just tends to work so my troubleshooting could use some practice.
I've installed evremap to try and sort out my keybinds

setup

I cloned it into ~/Applications folder and built with cargo,
then made a config file and put it in the default location

#/etc/evremap.toml
device_name = "AT Translated Set 2 keyboard"

[[remap]]
input = ["KEY_CAPSLOCK"]
output = ["KEY_BACKSPACE"]

[[dual_role]]
input = "KEY_LEFTSHIFT"
hold = ["KEY_LEFTSHIFT"]
tap = ["KEY_CAPSLOCK"]

Added the default service to /usr/lib/systemd/system/ and then set it up

[Service]
WorkingDirectory=/
ExecStart=bash -c "/usr/bin/evremap remap /etc/evremap.toml -d 0"
Restart=always

[Install]
WantedBy=multi-user.target

with the following commands as recommended by the README

$ sudo cp evremap.service /usr/lib/systemd/system/
$ sudo systemctl daemon-reload
$ sudo systemctl enable evremap.service
$ sudo systemctl start evremap.service

Created an input group
echo 'KERNEL=="event*", NAME="input/%k", MODE="660", GROUP="input"' | sudo tee /etc/udev/rules.d/input.rules
added evdev and uinput to the group
sudo gpasswd -a YOUR_USER input
echo 'KERNEL=="uinput", GROUP="input"' | sudo tee /etc/udev/rules.d/input.rules
rebooted

Issue

This dosen't appear to have worked as systemctl status evremap.service states "failed"
Process: 34059 ExecStart=bash -c /usr/bin/evremap remap /etc/evremap.toml -d 0 (code=exited, status=127)
full output:

× evremap.service
     Loaded: loaded (/usr/lib/systemd/system/evremap.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Tue 2024-01-16 04:56:13 GMT; 3s ago
   Duration: 6ms
    Process: 4883 ExecStart=bash -c /usr/bin/evremap remap /etc/evremap.toml -d 0 (code=exited, status=127)
   Main PID: 4883 (code=exited, status=127)
        CPU: 6ms

Jan 16 04:56:13 archlinux systemd[1]: evremap.service: Scheduled restart job, restart counter is at 5.
Jan 16 04:56:13 archlinux systemd[1]: evremap.service: Start request repeated too quickly.
Jan 16 04:56:13 archlinux systemd[1]: evremap.service: Failed with result 'exit-code'.
Jan 16 04:56:13 archlinux systemd[1]: Failed to start evremap.service.

ran sudo target/release/evremap remap /etc/evremap.toml just in case, no change.
Repeated all steps from [[setup]] again with no change.

As I understand it error code 127 indicates “command not found”
So I checked for the executable called at /usr/bin/evremap but no directory called evremap exists in /usr/bin/
I edited /usr/lib/systemd/system/evremap.service to call the folder I built evremap in /home/joe/Applications/evremap/ and ran

$ sudo cp evremap.service /usr/lib/systemd/system/
$ sudo systemctl daemon-reload
$ sudo systemctl enable evremap.service
$ sudo systemctl start evremap.service

again. Still no change.
Tried a similar thing with the path /home/joe/Applications/evremap/target/release/ but still no success.
remap just isn't a command on any of these paths.
I tried which -a remap but nothing relevant came up.
I'm not sure what to try next, any advice?

Add subcommand that prints the key code for a key on press

A cursory Google search hasn't shown an easy way to translate scancodes or X keycodes (obtained from xev running under XWayland) to the keycode string that the config expects. I've been tryong to remap the (<>) key (left of Z on my Model M 122) to Super. A simple command that just prints the pressed keycode to stdout until EOF would be very appreciated.


Edit: Further searching shows that the evtest program already implements this. Leaving this here for anyone searching for the solution in the future, close the issue if you'd like.

The key code was the very descriptive KEY_102ND, if you're curious.

Cannot Remap keys on Phillips G404 Keyboard

Like the guy in the issues with the cherry keyboard mine shows 4 diferent names. The first one shows an error "No device found with name SINO WEALTH Gaming KB". The other 3 executes the loop but nothing changes.

Screenshot_2023-07-29-22-14-14_12543

Issue with permissions in `/dev/uinput` after following setup instructions

When trying to set things up to run w/o sudo, I encountered the following issue, after following the instructions in https://github.com/wez/evremap#running-it
Most commands, like evremap list-devices, would work fine.
BUT evremap remap ... fails with:

Error: creating UInputDevice from /dev/input/event23

Caused by:
    EACCES: Permission denied

After some debugging, I found this is due to the permissions in /dev/uinput,
which in my system (Fedora) were:

crw-------. 1 root root 10, 223 Nov 5 18:22 /dev/uinput

That's despite having defined the rule with
echo 'KERNEL=="uinput", GROUP="input"' | sudo tee /etc/udev/rules.d/input.rules

I found this related issue,
by which it seems in some systems the rule might not trigger:
chrippa/ds4drv#93 (comment)

However, the solution proposed there did not work either for me.

As a workaround, I can do this:

sudo chgrp input /dev/uinput
sudo chmod 660 /dev/uinput

But it would be nice to get the rule-based approach to work.

If someone hits the same issue or has some idea on how to resolve, please let me know!

works in tty, but not in compositor.

when i remap a key event on my touch pen, it works in the tty, but doesnt seem to work in a wayland compositor(i tried hyprland and sway). it is still registered by evtest and wev as the right key event, but applications seem to ignore it.

key substitution maps alian keys

I couldn't think of a better description...

I'm using a HP Spectre laptop with a UK keyboard in the UK.

When I load this:

[ids]

*

[main]

# Maps capslock to escape when pressed and control when held.
### capslock = overload(control, esc)

# Remaps the escape key to capslock
### esc = capslock


rightcontrol =  \

### |\

I get '#' for [rightcontrol] and '~' for [shift+rightcontrol].
I get some other weirdness - like '£' for [#].

The keyboard is essentially this:
Screenshot from 2022-09-29 19-24-18
Except, there's no [\ & |] key immediately to the right of the [leftshift] key.
I figured for a moment that there was some mismatch between US and UK keyboards because the US [\ & |] key is where the UK [# & ~] key is - but, when I substituted in the '#' instead of '\' I got the '£' which seems to debunk that theory.

Obviously, I'm trying to map the missing [\ & |] key to the [rightcontrol] key - which is what is actually written on the [rightcontrol] key on my keyboard.

Inability to use remapped keys to remap more keys

I was considering switching away from keyszer which is an xkeysnail fork to everemap but found issues while migrating my configuration over.

Keys which have been remapped are unable to be remapped again. I found this by trying to remap capslock to F20 and then have other remaps depend on F20 with another key.

Configurations like this would be ideal:

[[remap]]
input = ["KEY_CAPSLOCK"]
output = ["KEY_F20"]

[[remap]]
input = ["KEY_F20", "KEY_W"]
output = ["KEY_HOME"]

[[remap]]
# this "deadnaming" could work for me but would probably be unintuitive for others
input = ["KEY_CAPSLOCK", "KEY_R"]
output = ["KEY_END"]

This would effectively disable capslock while still providing it as a modifier key for other remaps.

I also tried this remap but it sends w and q separately instead of remapping them to numlock.

[[remap]]
input = ["KEY_CAPSLOCK"]
output = ["KEY_W", "KEY_Q"]

[[remap]]
input = ["KEY_W", "KEY_Q"]
output = ["KEY_NUMLOCK"]
[[remap]]
input = ["KEY_CAPSLOCK"]
output = ["KEY_LEFTSHIFT", "KEY_Q"]

[[remap]]
input = ["KEY_LEFTSHIFT", "KEY_Q"]
output = ["KEY_NUMLOCK"]

This last one only types Q (capitalized) into a notepad.

Using the same config for several keyboards

Is it possible to use the same configuration for several input devices?

Ideally sth like:

  • I list Keyboards A and B in config.toml
  • I have Keyboards A and B connected, run evremap mapper config.toml and it starts acting on both A and B

If the above was possible, I wonder how connecting/disconnecting either of A/B would affect the process?

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.