Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package for keyd #744

Open
wants to merge 21 commits into
base: testing
Choose a base branch
from
Open

Add package for keyd #744

wants to merge 21 commits into from

Conversation

kiwiz
Copy link

@kiwiz kiwiz commented Oct 1, 2023

This PR adds keyd, a tool for remapping keys. It has been tested on an rM2.

No configuration is currently bundled. My intent is to create a separate keyd-configs package with community configs (and possibly a mechanism to automatically apply the right one for the active keymap).

package/keyd/default.conf Outdated Show resolved Hide resolved
package/keyd/package Outdated Show resolved Hide resolved
Co-authored-by: Nathaniel van Diepen <Eeems@users.noreply.github.com>
@Eeems Eeems self-requested a review October 2, 2023 19:29
@Eeems
Copy link
Member

Eeems commented Oct 2, 2023

I'll have to give this a test on my rM1 to make sure it works as expected. I assume you've tested the latest changes on your rM2 to make sure it works as expected?

@kiwiz
Copy link
Author

kiwiz commented Oct 2, 2023

I'll have to give this a test on my rM1 to make sure it works as expected. I assume you've tested the latest changes on your rM2 to make sure it works as expected?

Yep, all the keys appear to remap properly.

Testing tips:

  • Remaps should be as simple as:
[main]
a = x # remaps the a key to output x
  • Output of keyd should give you device ids, or you can just specify *

@Eeems Eeems added this to the 2023-W39 Merge Window milestone Oct 3, 2023
@Eeems Eeems added the packages Add or improve packages of the repository label Oct 21, 2023
@Eeems
Copy link
Member

Eeems commented Oct 27, 2023

image
So it looks like this won't work on the rM1 in 2.15.1. This will also fail to work on the rM2 for the same reason.

The keyd group also doesn't exist, and the default configuration expects it to exist. This will either need to fixed by the install scripts, or the configuration changed to not use the group.

@kiwiz
Copy link
Author

kiwiz commented Oct 30, 2023

Do you know what version the uinput module was enabled from? Should a version check be added to the package script?

@Eeems
Copy link
Member

Eeems commented Oct 30, 2023

Not offhand, it was one of the earlier 3.x versions I believe.
A version check doesn't make too much sense in the package, in reality we need to better support version limiting in the toltec repos themselves.

At this point, we will have to hold off on merging this until 3.x support is in progress.

@Eeems Eeems marked this pull request as draft November 24, 2023 20:59
@FouzR
Copy link

FouzR commented Dec 30, 2023

I just want to note that, when I installed the ipk from the build artifact, in the keyd.service, the expected line for ExecStart is /opt/bin/keyd. However, when I installed it, it was /usr/bin/keyd

So either we add a symlink, or try and fix this(which shouldn't happen considering it was supposed to be /opt/bin/keyd)

@Eeems
Copy link
Member

Eeems commented Dec 30, 2023

I just want to note that, when I installed the ipk from the build artifact, in the keyd.service, the expected line for ExecStart is /opt/bin/keyd. However, when I installed it, it was /usr/bin/keyd

So either we add a symlink, or try and fix this(which shouldn't happen considering it was supposed to be /opt/bin/keyd)

No we wouldn't want to have it be in /usr/bin. That's very odd that the file provided isn't being used. My guess is that the keyd source has its own copy of the service file that is replacing the one included in this repo.

@FouzR
Copy link

FouzR commented Dec 30, 2023

Yup, so I thought, why not copy over keyd.service later in the package code instead of at the very beginning(So maybe put it in a temp folder first)
So maybe just copy it over to /etc/systemd/system/ in configure()

@Eeems
Copy link
Member

Eeems commented Dec 30, 2023

I haven't looked too closely, but if there is a keyd.service file in the source that's overwriting the one included in the package folder, changing the order you install the files from the source directory wont do anything. The file isn't there to copy, because it's been replaced. The file will need to be renamed in this repo, and then renamed as part of package() when it's installing it to the final location in the package. Ideally the toltec build system (and toltecmk) should be updated to detect this kind of thing and error if there are files that are going to be clobbered.

@Etn40ff
Copy link

Etn40ff commented Dec 30, 2023

Checking for clobbered files it is probably hard: in this particular instance there is no overlapping in the sources, the problem arises at compiel time: https://github.com/rvaiya/keyd/blob/master/Makefile#L37

@Etn40ff
Copy link

Etn40ff commented Dec 30, 2023

In this particular case having a separate keyd.service is not needed: it suffices to add PREFIX=/opt/ to the build environment

@Eeems
Copy link
Member

Eeems commented Dec 31, 2023

In this particular case having a separate keyd.service is not needed: it suffices to add PREFIX=/opt/ to the build environment

A tiny bit more than that was required to do it properly, but it should be working now.

@Etn40ff
Copy link

Etn40ff commented Dec 31, 2023

This is still not working: the binary is /opt/bin/keyd but the service calls /opt/usr/bin/keyd. I think you are over engineering it a little, setting PREFIX should take care of the path in keyd.service

@Eeems
Copy link
Member

Eeems commented Dec 31, 2023

This is still not working: the binary is /opt/bin/keyd but the service calls /opt/usr/bin/keyd. I think you are over engineering it a little, setting PREFIX should take care of the path in keyd.service

It does not, which is why I added the sed line. I forgot that the default prefix is /usr. The latest code does, but we are dealing with the v2.4.3 tag which is missing some build process fixes.

@Etn40ff
Copy link

Etn40ff commented Dec 31, 2023

The latest code does, but we are dealing with the v2.4.3 tag which is missing some build process fixes.

This is annoying

@Eeems
Copy link
Member

Eeems commented Dec 31, 2023

The latest code does, but we are dealing with the v2.4.3 tag which is missing some build process fixes.

This is annoying

It is 😆 , the next time they push a release it will no longer be an issue.

@Eeems
Copy link
Member

Eeems commented Jan 13, 2024

For future reference when we get here, I think this is a good/sane default for the US layout. It at least makes the legends match what the keyboard actually outputs, and exposes some needed keys for terminal usage.

[ids]
2edd:0001 # type folio

[main]
end = layer(opt)
leftshift+end = layer(opt+shift)
= = -
\ = ~

[shift]
= = _
\ = `

[opt]
1 = esc
= = =
\ = \
0 = +
, = [
. = ]
right = end
left = home

[opt+shift]
\ = |
, = {
. = }
right = pagedown
left = pageup

Xochitl doesn't seem completely happy with allowing +/= on the 0/- keys though.

@FouzR
Copy link

FouzR commented Jan 17, 2024

Keyd seems to freak out on boot and has key-repeats even when the key is clicked once.. I have to restart the service to fix it

@Eeems
Copy link
Member

Eeems commented Jan 17, 2024

Keyd seems to freak out on boot and has key-repeats even when the key is clicked once.. I have to restart the service to fix it

I haven't experienced this. What settings are you using?

@FouzR
Copy link

FouzR commented Jan 17, 2024

[ids]
2edd:0001 # type folio

[main]
capslock = overload(control, esc) # Sets the capslock to act as Esc when tapped and Control when held
leftcontrol = overload(control, capslock) # similar or left control

# below 2 lines setup the layers for
# Opt and AltOpt on the Type Folio
end = layer(opt)
rightalt = layer(alternate)

[opt]
1 = esc
, = [
. = ]
/ = \
= = -
right = end
left = home
up = pageup
down = pagedown
backspace = delete

[alternate:G]
1 = f1
2 = f2
3 = f3
4 = f4
5 = f5
6 = f6
7 = f7
8 = f8
9 = f9
0 = f10
= = f11
backspace = f12

That’s my config fire

@Eeems
Copy link
Member

Eeems commented Jan 17, 2024

Have you checked the keyd logs to see if it has anything useful? It works by grabbing all other physical keyboard input and creating it's own evdev device with uinput to emit events from. uinput handles automatically emitting the key repeat events. Because of this, keyd might just have missed the event that the key was released.

@gustaphe
Copy link

For the scandinavian keyboard (and others that need non-ascii input keys), one would need xkbmap to make the compose-hack work.

@Eeems Eeems marked this pull request as ready for review May 20, 2024 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages Add or improve packages of the repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants