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

Held Alone remap not working as presented in README and there is no example in the sample config to show working behavior.. #290

Closed
jeremyjjbrown opened this issue May 6, 2023 · 9 comments

Comments

@jeremyjjbrown
Copy link

jeremyjjbrown commented May 6, 2023

It seams like Alone Hold does not work, but I am not able to verify if I am configuring it as intended.

My end goal is to remap CapsLock to Esc if tapped and to vim movements if held in combo with hjkl. I have created this key mapping before in QMK, Karbiner, AutoHotKey and xmodmap. Now I am moving to Sway so I wanted to try xremap for it's application specific functionality.

My last attempt looked like this:

modmap:
  - name: Caps Esc
    remap: # Required
      CapsLock:
        held: Super # Required
        alone: Esc # Required

keymap:
  - remap:
      Super-h: Left
      Super-j: Down
      Super-k: Up
      Super-l: Right

It wouldn't be my preferred solution to involve Super, but really nothing I have attempted for movements has worked. Any corrections to what I have here, or an example in the sample config would be very appreciated.

@k0kubun
Copy link
Contributor

k0kubun commented May 6, 2023

I'd like to have a look at actual key events in your environment. Could you start xremap with RUST_LOG=debug xremap, enter a sequence you want to remap, paste the entire command output here, and clarify the expected outcome? It'd be nice to have that for a tapped case and a held case separately.

xmodmap

off topic: I didn't know xmodmap could do this kind of thing. Out of curiosity, may I see a configuration for xmodmap that implements this?

@jixiuf
Copy link
Contributor

jixiuf commented May 7, 2023

I use dual-function-keys (a plug for Interception Tools )
space: tap for space, held for ctrl+cmd+alt

see my config udevmon.yaml
dual-function-keys.yaml
udevmon

and see alols/xcape#122

@jeremyjjbrown
Copy link
Author

jeremyjjbrown commented May 7, 2023

Here is my xmodmap.

  cat .xmodmap
keycode 66 = Mode_switch
keysym h = h H Left
keysym l = l L Right
keysym k = k K Up
keysym j = j J Down
keysym u = u U Prior
keysym i = i I Home
keysym o = o O End
keysym p = p P Next

Here is my keyd config I created since filing the ticket that does what I need.


[ids]

*

[main]

capslock = overload(capslock, esc)

# The default shift layer (the layer activated when shift is pressed).
[shift]

capslock = layer(capslock_shift)

[capslock:C]

shift = layer(capslock_shift)
h = left
j = down
k = up
l = right

[capslock_shift]

h = C-left
j = C-down
k = C-up
l = C-right

If I use the config I left above I get an error:

  sudo RUST_LOG=debug xremap .config/xremap/config.yml
Error: Failed to load config '.config/xremap/config.yml': modmap[0].remap: data did not match any variant of untagged enum ModmapAction at line 4 column 7

@k0kubun
Copy link
Contributor

k0kubun commented May 7, 2023

Thanks. Can you also work on the above "RUST_LOG=debug xremap" request please? I'll need it to investigate what went wrong in your environment.

@jeremyjjbrown
Copy link
Author

Updated above. Thanks.

@k0kubun
Copy link
Contributor

k0kubun commented May 7, 2023

Oh, I haven't noticed that your config isn't parseable. I'm sorry about the serde_yaml's generic error message.

It took some time for me to understand what's wrong too, but it appears that held: Super is what was wrong. It should be either held: Super_L or held: Super_R because Super doesn't represent a single key.

@jeremyjjbrown
Copy link
Author

Cool, let me try it. Is there a way to accomplish this without involving Super_* ?

@k0kubun
Copy link
Contributor

k0kubun commented May 7, 2023

I tried using virtual_modifiers for it, but it doesn't seem to support combining it with held / alone currently. So at the moment, using other modifiers like Alt_* would be the only alternative if you need to change the key when tapped.

@jeremyjjbrown
Copy link
Author

Feel free to close this ticket if you feel it's not needed.

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

3 participants