map2
map2 copied to clipboard
Failing to properly remap capslock to meta/super key
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?
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.
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:
- The CAPSLOCK functionality continued to be triggered
- 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)
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: