Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,30 @@ editing the `conf` file in a text editor. Use the examples as reference.
</tr>
</table>

### key_leftalt_to_key_cmd

<table>
<tr>
<td>Description</td>
<td colspan="2">
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.}
</td>
</tr>
<tr>
<td>Default</td>
<td colspan="2">@code{}
disabled
@endcode</td>
</tr>
<tr>
<td>Example</td>
<td colspan="2">@code{}
key_leftalt_to_key_cmd = enabled
@endcode</td>
</tr>
</table>

### mouse

<table>
Expand Down
3 changes: 3 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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<int>::min();
int_f(vars, "back_button_timeout", to);

Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/platform/macos/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <mach/mach.h>

// local includes
#include "src/config.h"
#include "src/display_device.h"
#include "src/input.h"
#include "src/logging.h"
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src_assets/common/assets/web/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ <h1 class="my-4">{{ $t('config.configuration') }}</h1>
"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",
Expand Down
9 changes: 9 additions & 0 deletions src_assets/common/assets/web/configs/tabs/Inputs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ const config = ref(props.config)
default="false"
></Checkbox>

<!-- Mapping Key AltLeft to Key Command -->
<Checkbox v-if="config.keyboard === 'enabled' && platform === 'macos'"
class="mb-3"
id="key_leftalt_to_key_cmd"
locale-prefix="config"
v-model="config.key_leftalt_to_key_cmd"
default="false"
></Checkbox>

<!-- Enable Mouse Input -->
<hr>
<Checkbox class="mb-3"
Expand Down
2 changes: 2 additions & 0 deletions src_assets/common/assets/web/public/assets/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@
"key_repeat_frequency_desc": "How often keys repeat every second. This configurable option supports decimals.",
"key_rightalt_to_key_win": "Map Right Alt key to Windows key",
"key_rightalt_to_key_win_desc": "It may be possible that you cannot send the Windows Key from Moonlight directly. In those cases it may be useful to make Sunshine think the Right Alt key is the Windows key",
"key_leftalt_to_key_cmd": "Map Left Alt key to Command key",
"key_leftalt_to_key_cmd_desc": "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.",
"keybindings": "Keybindings",
"keyboard": "Enable Keyboard Input",
"keyboard_desc": "Allows guests to control the host system with the keyboard",
Expand Down
2 changes: 2 additions & 0 deletions src_assets/common/assets/web/public/assets/locale/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@
"key_repeat_frequency_desc": "How often keys repeat every second. This configurable option supports decimals.",
"key_rightalt_to_key_win": "Map Right Alt key to Windows key",
"key_rightalt_to_key_win_desc": "It may be possible that you cannot send the Windows Key from Moonlight directly. In those cases it may be useful to make Sunshine think the Right Alt key is the Windows key",
"key_leftalt_to_key_cmd": "Map Left Alt key to Command key",
"key_leftalt_to_key_cmd_desc": "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.",
"keybindings": "Keybindings",
"keyboard": "Enable Keyboard Input",
"keyboard_desc": "Allows guests to control the host system with the keyboard",
Expand Down
2 changes: 2 additions & 0 deletions src_assets/common/assets/web/public/assets/locale/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@
"key_repeat_frequency_desc": "How often keys repeat every second. This configurable option supports decimals.",
"key_rightalt_to_key_win": "Map Right Alt key to Windows key",
"key_rightalt_to_key_win_desc": "It may be possible that you cannot send the Windows Key from Moonlight directly. In those cases it may be useful to make Sunshine think the Right Alt key is the Windows key",
"key_leftalt_to_key_cmd": "Map Left Alt key to Command key",
"key_leftalt_to_key_cmd_desc": "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.",
"keybindings": "Keybindings",
"keyboard": "Enable Keyboard Input",
"keyboard_desc": "Allows guests to control the host system with the keyboard",
Expand Down