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

[SUGGESTION] Use keyd daemon instead of a remap script for more reliability. #1435

Open
TurtleMeds opened this issue Oct 1, 2024 · 1 comment

Comments

@TurtleMeds
Copy link

The default remap script does not persist well when new keyboards are plugged in or sometimes the remaps seem to disable themselves. The current method also does not work in the TTY, whereas the keyd daemon does.
It's also very lightweight and fast compared to the current solution using setxkbmap and xcape.

here is a simple config to remap caps lock to esc and meta:

[ids]

# accept all keyboards for this remap
*

[main]

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

You can also go much deeper with this. Here is my current config with home row mods (able to be disabled for things that may need you to hold down keys) and a layer with hjkl converted to arrow keys:

[ids]

*

[main]

capslock = overload(arrows, esc)
bookmarks = toggle(disablehrm)

esc = capslock

# home row mods

a = overloadi(a, overloadt(alt, a, 200), 150)
s = overloadi(s, overloadt(shift, s, 200), 150)
d = overloadi(d, overloadt(control, d, 200), 150)
f = overloadi(f, overloadt(meta, f, 200), 150)

j = overloadi(j, overloadt(meta, j, 200), 150)
k = overloadi(k, overloadt(control, k, 200), 150)
l = overloadi(l, overloadt(shift, l, 200), 150)
; = overloadi(;, overloadt(alt, ;, 200), 150)

[disablehrm]

a = a
s = s
d = d
f = f

j = j
k = k
l = l
; = ;

[arrows]

h = left
j = down
k = up
l = right
@RetroViking
Copy link

RetroViking commented Oct 5, 2024

Great suggestion, thank you @TurtleMeds . In addition to what you said, I noticed that the current LARBS method also maps the meta keys to esc, leading to a whopping 4 escape keys on the same keyboard (if you have two meta keys).

I tested keyd and can confirm it's an easy switch for Arch Linux users, probably for Artix users as well. To use keyd, remove the remapd entry in ~/.config/x11/xprofile and restart. Then run pacman -S keyd and, as sudo, copy the following to /etc/keyd/default.conf (this file must be created).

[ids]

*

[main]

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

# Maps menu button to meta.
compose = rightmeta

To apply your remaps, start the daemon with sudo systemctl enable --now keyd. That's it. (Artix users will enable this according to their own init system).

To keep the default LARBS cursor speed, you can add a line containing xset r rate 300 50 to ~/.config/x11/xprofile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants