diff --git a/docs/configuration.md b/docs/configuration.md
index 8e59c0ab0ad..3404560dba4 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -614,6 +614,30 @@ editing the `conf` file in a text editor. Use the examples as reference.
+### key_leftalt_to_key_cmd
+
+
+
+ | Description |
+
+ On macOS, map the Left Alt key from Moonlight to the left Command key. This can be useful when the client cannot send the Windows key directly.
+ @caution{Applies to macOS only.}
+ |
+
+
+ | Default |
+ @code{}
+ disabled
+ @endcode |
+
+
+ | Example |
+ @code{}
+ key_leftalt_to_key_cmd = enabled
+ @endcode |
+
+
+
### mouse
diff --git a/src/config.cpp b/src/config.cpp
index a79f7d88151..7dae8809177 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -580,6 +580,7 @@ namespace config {
true, // mouse enabled
true, // controller enabled
true, // always send scancodes
+ false, // map left alt to command on macOS
true, // high resolution scrolling
true, // native pen/touch support
};
@@ -1279,6 +1280,8 @@ namespace config {
input.keybindings.emplace(0xA5, 0x5B);
}
+ bool_f(vars, "key_leftalt_to_key_cmd", input.key_leftalt_to_key_cmd);
+
to = std::numeric_limits::min();
int_f(vars, "back_button_timeout", to);
diff --git a/src/config.h b/src/config.h
index eb778a3ac68..d4489d2e492 100644
--- a/src/config.h
+++ b/src/config.h
@@ -212,6 +212,7 @@ namespace config {
bool controller;
bool always_send_scancodes;
+ bool key_leftalt_to_key_cmd;
bool high_resolution_scrolling;
bool native_pen_touch;
diff --git a/src/platform/macos/input.cpp b/src/platform/macos/input.cpp
index d3bf20057ba..00dcab499eb 100644
--- a/src/platform/macos/input.cpp
+++ b/src/platform/macos/input.cpp
@@ -14,6 +14,7 @@
#include
// local includes
+#include "src/config.h"
#include "src/display_device.h"
#include "src/input.h"
#include "src/logging.h"
@@ -229,6 +230,10 @@ const KeyCodeMap kKeyCodesMap[] = {
// clang-format on
int keysym(int keycode) {
+ if (config::input.key_leftalt_to_key_cmd && keycode == 0xA4 /* VKEY_LMENU */) {
+ return kVK_Command;
+ }
+
KeyCodeMap key_map {};
key_map.win_keycode = keycode;
diff --git a/src_assets/common/assets/web/config.html b/src_assets/common/assets/web/config.html
index 513932a2cf9..bbb34b48969 100644
--- a/src_assets/common/assets/web/config.html
+++ b/src_assets/common/assets/web/config.html
@@ -209,6 +209,7 @@ {{ $t('config.configuration') }}
"key_repeat_frequency": 24.9,
"always_send_scancodes": "enabled",
"key_rightalt_to_key_win": "disabled",
+ "key_leftalt_to_key_cmd": "disabled",
"mouse": "enabled",
"high_resolution_scrolling": "enabled",
"native_pen_touch": "enabled",
diff --git a/src_assets/common/assets/web/configs/tabs/Inputs.vue b/src_assets/common/assets/web/configs/tabs/Inputs.vue
index 7fa76a20721..aa91a839325 100644
--- a/src_assets/common/assets/web/configs/tabs/Inputs.vue
+++ b/src_assets/common/assets/web/configs/tabs/Inputs.vue
@@ -155,6 +155,15 @@ const config = ref(props.config)
default="false"
>
+
+
+