Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save informationsea/df7d67bb9b30481c78ab4a432584039c to your computer and use it in GitHub Desktop.
Save informationsea/df7d67bb9b30481c78ab4a432584039c to your computer and use it in GitHub Desktop.
Swap Option key and Super Key of Tiger VNC 1.13.1
diff --git a/.gitignore b/.gitignore
index 2e864422..a0f86506 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,5 @@ CMakeCache.txt
Makefile
Makefile.in
config.h
+build/
+.DS_Store
\ No newline at end of file
diff --git a/vncviewer/cocoa.mm b/vncviewer/cocoa.mm
index d801a106..7600f707 100644
--- a/vncviewer/cocoa.mm
+++ b/vncviewer/cocoa.mm
@@ -352,14 +352,14 @@ int cocoa_event_keycode(const void *event)
{ kVK_Space, XK_space },
{ kVK_Delete, XK_BackSpace },
{ kVK_Escape, XK_Escape },
- { kVK_RightCommand, XK_Super_R },
- { kVK_Command, XK_Super_L },
+ { kVK_RightCommand, XK_Alt_R }, // Swap command and alt
+ { kVK_Command, XK_Alt_L }, // Swap command and alt
{ kVK_Shift, XK_Shift_L },
{ kVK_CapsLock, XK_Caps_Lock },
- { kVK_Option, XK_Alt_L },
+ { kVK_Option, XK_Super_L }, // Swap command and alt
{ kVK_Control, XK_Control_L },
{ kVK_RightShift, XK_Shift_R },
- { kVK_RightOption, XK_Alt_R },
+ { kVK_RightOption, XK_Super_R }, // Swap command and alt
{ kVK_RightControl, XK_Control_R },
{ kVK_F17, XK_F17 },
{ kVK_VolumeUp, XF86XK_AudioRaiseVolume },
@@ -469,8 +469,9 @@ int cocoa_event_keysym(const void *event)
modifiers |= alphaLock;
if ([nsevent modifierFlags] & NSShiftKeyMask)
modifiers |= shiftKey;
- if ([nsevent modifierFlags] & NSAlternateKeyMask)
- modifiers |= optionKey;
+ // ignore option key
+ // if ([nsevent modifierFlags] & NSAlternateKeyMask)
+ // modifiers |= optionKey;
chars = key_translate(key_code, modifiers);
if (chars == nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment