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

Match remaps even if extra modifiers are held #102

Closed
danyspin97 opened this issue May 24, 2022 · 9 comments · Fixed by #145
Closed

Match remaps even if extra modifiers are held #102

danyspin97 opened this issue May 24, 2022 · 9 comments · Fixed by #145

Comments

@danyspin97
Copy link

I am replacing rightalt + n with left key and a couple more. However, it requires a new remap for every added modifier combination.

keymap:
  - name: Arrows
    remap:
      alt_r-n: left
      alt_r-e: down
      alt_r-i: up
      alt_r-o: right
      super-alt_r-n: super-left
      super-alt_r-e: super-down
      super-alt_r-i: super-up
      super-alt_r-o: super-right
      super-shift_l-alt_r-n: super-shift_l-left
      super-shift_l-alt_r-e: super-shift_l-down
      super-shift_l-alt_r-i: super-shift_l-up
      super-shift_l-alt_r-o: super-shift_l-right

Is there an way to just add the first four remaps and make them work with any other modifier automatically? I have tried with modmap but I couldn't make it work.

@k0kubun
Copy link
Contributor

k0kubun commented May 25, 2022

Yeah, I think alt_r-n: left alone should remap whatever-alt_r-n to whatever-left. It's currently not working that way due to a premature optimization in the implementation.

I'll work on this when I can allocate time to work on this. Meanwhile, please use the current workaround and also consider generating it with a template as needed.

@k0kubun
Copy link
Contributor

k0kubun commented Jul 29, 2022

Update: As I'm currently focusing on a big change for another OSS, I'm planning to work on this issue on Aug 13th. If I receive a pull request before that, I can take a look at that too.

@k0kubun k0kubun changed the title Automaticaly adding modifiers in keymap Match remaps even if there are extra modifiers Aug 14, 2022
@k0kubun k0kubun changed the title Match remaps even if there are extra modifiers Match remaps even if extra modifiers are held Aug 14, 2022
@k0kubun
Copy link
Contributor

k0kubun commented Aug 14, 2022

Released #145 in v0.6.0. Enjoy.

@nullbyto
Copy link

For report: i tried it with release v0.7.0 and downloaded v0.6.0, it's not working for me. I'm not sure if I have to do something extra.

@k0kubun
Copy link
Contributor

k0kubun commented Aug 14, 2022

In addition to the version, could you report the following information?

  • Platform: X11, GNOME Wayland, or Sway
  • Your config (preferably minimum one)
  • Output of RUST_LOG=debug xremap

For example, using xremap v0.7.0 on X11, my config to test this behavior is:

keymap:
  - remap:
      alt_r-n: left

and the RUST_LOG=debug xremap is:

[2022-08-14T22:23:35Z DEBUG xremap::event_handler] => 1: KEY_LEFTCTRL
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 1: KEY_LEFTCTRL
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] => 1: KEY_RIGHTALT
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 1: KEY_RIGHTALT
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] => 1: KEY_N
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 0: KEY_LEFTCTRL
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 0: KEY_RIGHTALT
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 1: KEY_LEFT
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 0: KEY_LEFT
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 1: KEY_LEFTCTRL
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 1: KEY_RIGHTALT
^[[D[2022-08-14T22:23:35Z DEBUG xremap::event_handler] => 0: KEY_LEFTCTRL
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 0: KEY_LEFTCTRL
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] => 0: KEY_N
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 0: KEY_N
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] => 0: KEY_RIGHTALT
[2022-08-14T22:23:35Z DEBUG xremap::event_handler] 0: KEY_RIGHTALT

As you can see, while Ctrl-Alt-N is pressed (ctrl is not needed), Left is emitted successfully.

@k0kubun
Copy link
Contributor

k0kubun commented Aug 14, 2022

Well, I guess you want to leave the extra modifier, e.g. Ctrl-Alt-N should be Ctrl-Left? I'm not sure if it's what you mean, but I can work on fixing this.

@nullbyto
Copy link

nullbyto commented Aug 14, 2022

Yes thats what i mean. So no need to write all the combinations. It makes configurating cleaner.

Edit: I think thats what the author meant as well. Let me know if an extra log is still needed, because i have the same result.

@k0kubun
Copy link
Contributor

k0kubun commented Aug 14, 2022

Addressed it in v0.7.1. Please try that version.

@nullbyto
Copy link

Works perfectly! Thanks for your great work.

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

Successfully merging a pull request may close this issue.

3 participants