map2 icon indicating copy to clipboard operation
map2 copied to clipboard

Failing to properly remap capslock to meta/super key

Open arilebedey opened this issue 2 years ago • 2 comments

I've been trying to remap CAPSLOCK to Super_L via your method,

{capslock down}::{
  caps_down = true;
  key_pressed = false;
  send("{ctrl down}");
};

{capslock up}::{
  caps_down = false;
  send("{ctrl up}");
  if (key_pressed == false){
    send("{esc}");
  }
};

where I tried replacing ctrl with win, super, hyper, Super_L, and 0xffeb. No success.

Would there be a way to achieve this by default, or should I be looking into modifying the source code itself?

arilebedey avatar Apr 14 '22 22:04 arilebedey

I'm currently using the python version, but for this most things should be the same. If you're just trying to output the win key (or whatever you want to call it), you have to output meta as per linux key event codes.

A line from my current daily-driver script:

if tab_pressed: writer.send("{alt down}{meta down}{shift down}" + key + "{alt up}{meta up}{shift up}");

Also for what you're doing it might be smart to use send_modifier (check docs) instead, so it doesn't break other mappings using meta.

shiro avatar Apr 14 '22 23:04 shiro

My current working solution using send() instead of send_modifier():

{capslock down}::{
  send("{meta down}");
};

{capslock up}::{
  send("{meta up}");
};

I have not yet tried to include mappings that include meta, since I'm not planning on remapping too many keys/devices using map2 at the moment anyway. NOTE TO AUTHOR/FUTURE CONTRIBUTORS: I have tried replacing send() with send_modifier() for the meta up/down calls and two issues happened:

  1. The CAPSLOCK functionality continued to be triggered
  2. Once the key was pressed, it appeared as though send_modifier("{meta up}") call never went through (as I was left with a continuously simulated meta key press afterwards)

arilebedey avatar Apr 15 '22 16:04 arilebedey

There was recently the big upgrade to version 2, which fixes this issue :rocket:

If there's other related bugs, please open a new issue :bow:

shiro avatar Dec 04 '23 03:12 shiro