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

Allow for normal key overload. #919

Open
voronind-com opened this issue Jan 22, 2025 · 3 comments
Open

Allow for normal key overload. #919

voronind-com opened this issue Jan 22, 2025 · 3 comments

Comments

@voronind-com
Copy link

The scenario I have is that when I tap esc key it is used as a grave symbol, but when held I use it as a print key for Sway combos like print+a or print+b. Basically I want it to behave like a character input on tap and held print key when held. Currently I have to use timeout(grave, 150, print) because overload(print, grave) doesn't work, which is sub-optimal. Thanks!

@nsbgn
Copy link
Collaborator

nsbgn commented Jan 22, 2025 via email

@voronind-com
Copy link
Author

You can do:

[ids]
*
[main]
esc = overload(print, grave)
[print]
a = print+a
b= print+b

... etcetera. There are issues in the backlog to make this sort of thing easier and less verbose in the future - I can look them up later.

That will work I guess. Thanks! Should I close the issue or keep it to track the progress?

@voronind-com
Copy link
Author

voronind-com commented Jan 22, 2025

Got it working!

For NixOS users it's somewhat easy to generate:

let
  mkAllLetterKeysSet =
    mkValue:
    "abcdefghijklmnopqrstuvwxyz"
    |> lib.strings.stringToCharacters
    |> map (key: {
      name = key;
      value = mkValue key;
    })
    |> lib.listToAttrs;
in
{
  services.keyd.keyboards.default.settings = {
    main.esc = "overload(layer_print, grave)";
    layer_print = mkAllLetterKeysSet (key: "macro(print+${key})");
  };
}

This will generate

[layer_print]
a=macro(print+a)
b=macro(print+b)
c=macro(print+c)
d=macro(print+d)
e=macro(print+e)
f=macro(print+f)
g=macro(print+g)
h=macro(print+h)
i=macro(print+i)
j=macro(print+j)
k=macro(print+k)
l=macro(print+l)
m=macro(print+m)
n=macro(print+n)
o=macro(print+o)
p=macro(print+p)
q=macro(print+q)
r=macro(print+r)
s=macro(print+s)
t=macro(print+t)
u=macro(print+u)
v=macro(print+v)
w=macro(print+w)
x=macro(print+x)
y=macro(print+y)
z=macro(print+z)

[main]
esc=overload(layer_print, grave)

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