-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
OSX ctrl cmd swapped - way to swap in kitty too? #1077
Comments
You cannot remap modifiers in kitty, I'm afraid. The closest you can |
FYI, I've made a simple patch to address this problem, see 056c124 |
@kovidgoyal, is there any way you would be able to take a look at the latest patch from @sergei-dyshel and see if there's a way to make this configurable? It does exactly what I want, and it would be amazing to offer it to everyone. a076d0c |
Not something I am interested in personally, sorry. |
Here's my vision of why one would like to swap On Linux (and Window) On MacOS the situation is more complex, since So according to my "classification" But this is only my personal option and I understand that my patch is just a dirty hack and implementing this feature properly would require much more dev effort so I fully agree with @kovidgoyal's stance. @flowchartsman |
@kovidgoyal Of course! I'm happy to explain. I feel the same way as @sergei-dyshel, but would like to give a few reasons of my own:
I hope that explains my rationale. iterm2 provides this ability for probably similar reasons, but I really like Kitty, and would like this option there. I think it would make a very useful configuration option. Of course I don't believe it should be on by default! :) @sergei-dyshel: I'm aware of Karabiner, but that is way too heavy of a tool for this use, and I've had trouble getting it to work. As for Kitty, I don't know the codebase well enough to know how much work it would be to make it a configuration option. That's why I mentioned @kovidgoyal. I was hoping to at least get some guidance on doing this the right way. I understand if it's not something he uses or wants to take the time to do, but at least some kind of guidance would be helpful so we can give back instead of just maintaining personal hacks. |
BTW, I'd like to add that Karabiner rule would swap modifiers for system keybindings too, i.e. if you have |
I'm fine with a patch adding such an (off-by-default) option, I'm just not motivated enough to come up with one myself. |
@kovidgoyal, thank you for directing me to this issue +1 to everything in this issue |
@kovidgoyal Understood. Would you be willing to provide a little direction on me or @sergei-dyshel integrating this the proper way? Anything we should be aware of? I'll take a crack at it. |
Feel free to ask if you have questions, in general, this will need to be |
I'm a very big fan of kitty, but unfortunately, lack of this feature on mac is preventing me to use it, I see a lot of people on blogs are struggling with this. I hope you change your mind @kovidgoyal. |
@ultrox |
@sergei-dyshel will try that, thank you! |
Can the same be applied to x11 version? Should the swapping be done inside x11_window.c? |
After getting a Mac in addition to a Linux workstation the difference was driving me crazy. On the OS/QMK side I put "Control" on the same key as Mac "Command" as muscle memory is very strong. This makes pretty much all GUI apps equivalent. But terminals is the one place it's different due to the dedicated control key in Macs. Since on Linux I don't use a DE that uses the super key, I'm now using @aliher1911 fork to remap Super and Control on linux kitty such that things match. The advantage of making Super the Control key in kitty, is that the real control can still be used for the normal shortcuts, just like MacOS. E.g. once swapped, to make simple Control+C and Control+V do copy and paste:
Now we can have total parity between mac and linux from terminal to browser! |
I would hope to see an option to swap option and command key on mac. AFAIK, option and command key are interpreted by kitty as "alt" and "super". However, on mac, option is on the left of command, but on a standard keyboard, alt is on the right of super. UPDATE: I use this patch to swap command and option. |
Created a new patch for command <-> control swap with the latest HEAD. |
Could someone provide an instruction how to achieve it on mac? Because some forks and paches as mentioned and it is still not very clear if it is possible in the last kitty release and how to configure it. Thank you, |
sorry, still not clear. The comment mentioned swap ctrl<=>cmd #1077 (comment) - is it some global change outside kitty? Should I add something into kitty after the change or it is just kitty config? |
hey here's an updated version of that patch to swap ctrl and super that works as of now: diff --git a/gen/key_constants.py b/gen/key_constants.py
index 7bf9a90d8..119eac65b 100755
--- a/gen/key_constants.py
+++ b/gen/key_constants.py
@@ -113,15 +113,15 @@
raise_volume XF86AudioRaiseVolume - -
mute_volume XF86AudioMute - -
left_shift Shift_L 0x38 -
-left_control Control_L 0x3B -
+left_control Super_L 0x3B -
left_alt Alt_L 0x3A -
-left_super Super_L 0x37 -
+left_super Control_L 0x37 -
left_hyper Hyper_L - -
left_meta Meta_L - -
right_shift Shift_R 0x3C -
-right_control Control_R 0x3E -
+right_control Super_R 0x3E -
right_alt Alt_R 0x3D -
-right_super Super_R 0x36 -
+right_super Control_R 0x36 -
right_hyper Hyper_R - -
right_meta Meta_R - -
iso_level3_shift ISO_Level3_Shift - -
diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m
index 79e4104a1..16b50dd54 100644
--- a/glfw/cocoa_window.m
+++ b/glfw/cocoa_window.m
@@ -108,13 +108,13 @@
case 0x4c: return GLFW_FKEY_KP_ENTER;
case 0x51: return GLFW_FKEY_KP_EQUAL;
case 0x38: return GLFW_FKEY_LEFT_SHIFT;
- case 0x3b: return GLFW_FKEY_LEFT_CONTROL;
+ case 0x37: return GLFW_FKEY_LEFT_CONTROL;
case 0x3a: return GLFW_FKEY_LEFT_ALT;
- case 0x37: return GLFW_FKEY_LEFT_SUPER;
+ case 0x3b: return GLFW_FKEY_LEFT_SUPER;
case 0x3c: return GLFW_FKEY_RIGHT_SHIFT;
- case 0x3e: return GLFW_FKEY_RIGHT_CONTROL;
+ case 0x36: return GLFW_FKEY_RIGHT_CONTROL;
case 0x3d: return GLFW_FKEY_RIGHT_ALT;
- case 0x36: return GLFW_FKEY_RIGHT_SUPER;
+ case 0x3e: return GLFW_FKEY_RIGHT_SUPER;
/* end vk to functional */
default:
return 0;
@@ -438,11 +438,11 @@ static void releaseMonitor(_GLFWwindow* window)
if (flags & NSEventModifierFlagShift)
mods |= GLFW_MOD_SHIFT;
if (flags & NSEventModifierFlagControl)
- mods |= GLFW_MOD_CONTROL;
+ mods |= GLFW_MOD_SUPER;
if (flags & NSEventModifierFlagOption)
mods |= GLFW_MOD_ALT;
if (flags & NSEventModifierFlagCommand)
- mods |= GLFW_MOD_SUPER;
+ mods |= GLFW_MOD_CONTROL;
if (flags & NSEventModifierFlagCapsLock)
mods |= GLFW_MOD_CAPS_LOCK;
@@ -1033,11 +1033,11 @@ - (NSTextInputContext *)inputContext
if (flags & NSEventModifierFlagShift)
mods |= shiftKey;
if (flags & NSEventModifierFlagControl)
- mods |= controlKey;
+ mods |= cmdKey;
if (flags & NSEventModifierFlagOption)
mods |= optionKey;
if (flags & NSEventModifierFlagCommand)
- mods |= cmdKey;
+ mods |= controlKey;
if (flags & NSEventModifierFlagCapsLock)
mods |= alphaLock;
@@ -1223,10 +1223,10 @@ - (void)flagsChanged:(NSEvent *)event
case GLFW_FKEY_CAPS_LOCK:
mod_name = "capslock";
action = modifierFlags & NSEventModifierFlagCapsLock ? GLFW_PRESS : GLFW_RELEASE; break;
- case GLFW_FKEY_LEFT_SUPER: action_for(super, NX_DEVICELCMDKEYMASK, NX_DEVICERCMDKEYMASK, NX_COMMANDMASK);
- case GLFW_FKEY_RIGHT_SUPER: action_for(super, NX_DEVICERCMDKEYMASK, NX_DEVICELCMDKEYMASK, NX_COMMANDMASK);
- case GLFW_FKEY_LEFT_CONTROL: action_for(ctrl, NX_DEVICELCTLKEYMASK, NX_DEVICERCTLKEYMASK, NX_CONTROLMASK);
- case GLFW_FKEY_RIGHT_CONTROL: action_for(ctrl, NX_DEVICERCTLKEYMASK, NX_DEVICELCTLKEYMASK, NX_CONTROLMASK);
+ case GLFW_FKEY_LEFT_CONTROL: action_for(super, NX_DEVICELCMDKEYMASK, NX_DEVICERCMDKEYMASK, NX_COMMANDMASK);
+ case GLFW_FKEY_RIGHT_CONTROL: action_for(super, NX_DEVICERCMDKEYMASK, NX_DEVICELCMDKEYMASK, NX_COMMANDMASK);
+ case GLFW_FKEY_LEFT_SUPER: action_for(ctrl, NX_DEVICELCTLKEYMASK, NX_DEVICERCTLKEYMASK, NX_CONTROLMASK);
+ case GLFW_FKEY_RIGHT_SUPER: action_for(ctrl, NX_DEVICERCTLKEYMASK, NX_DEVICELCTLKEYMASK, NX_CONTROLMASK);
case GLFW_FKEY_LEFT_ALT: action_for(alt, NX_DEVICELALTKEYMASK, NX_DEVICERALTKEYMASK, NX_ALTERNATEMASK);
case GLFW_FKEY_RIGHT_ALT: action_for(alt, NX_DEVICERALTKEYMASK, NX_DEVICELALTKEYMASK, NX_ALTERNATEMASK);
case GLFW_FKEY_LEFT_SHIFT: action_for(shift, NX_DEVICELSHIFTKEYMASK, NX_DEVICERSHIFTKEYMASK, NX_SHIFTMASK);
@@ -3113,11 +3113,11 @@ GLFWAPI GLFWColorScheme glfwGetCurrentSystemColorTheme(bool query_if_unintialize
if (glfw_mods & GLFW_MOD_SHIFT)
*cocoa_mods |= NSEventModifierFlagShift;
if (glfw_mods & GLFW_MOD_CONTROL)
- *cocoa_mods |= NSEventModifierFlagControl;
+ *cocoa_mods |= NSEventModifierFlagCommand;
if (glfw_mods & GLFW_MOD_ALT)
*cocoa_mods |= NSEventModifierFlagOption;
if (glfw_mods & GLFW_MOD_SUPER)
- *cocoa_mods |= NSEventModifierFlagCommand;
+ *cocoa_mods |= NSEventModifierFlagControl;
if (glfw_mods & GLFW_MOD_CAPS_LOCK)
*cocoa_mods |= NSEventModifierFlagCapsLock;
return _glfwPlatformGetNativeKeyForKey(glfw_key); |
Hi,
since I have ctrl and cmd swapped in the whole system I wonder, if there is the possibility to swap them in the kitty config as well (since I would need to use CMD+C in order to issue a Ctrl+C console behaviour). Haven't found anything so far.
I tried remapping them directly with the glfw keys (swapped 0x2 and 0x8 here) without success.
on_key_input: glfw key: 347 native_code: 0x36 action: PRESS mods: 0x2 text: ''
on_key_input: glfw key: 341 native_code: 0x3b action: PRESS mods: 0x8 text: ''
Is this somehow possible
viennaa
The text was updated successfully, but these errors were encountered: