LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
19.8k stars 956 forks source link

keybindings config not working #3285

Open yoooooolx opened 1 month ago

yoooooolx commented 1 month ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue present in the latest beta/pre-release?

This issue is present in the latest pre-release

Describe the Bug

I added the following lines to sunshine.conf as the documentation said in https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/advanced_usage.html#keybindings keybindings = [ 0x10, 0xA0, 0x11, 0xA2, 0x12, 0xA4, 0x4A, 0x4B ] After a restart of sunshine, nothing happened. Then I tried to set always_send_scancodes to enabled or disabled, neither workd.

Expected Behavior

As far as I think, this config should remap j to k, so when I press j a k should appear on my text editor. However when I press j a j appears, and when I press k a k appears.

Additional Context

No response

Host Operating System

Windows

Operating System Version

Windows 10 Professional 22H2, version 19045.5011

Architecture

amd64/x86_64

Sunshine commit or version

Version v2024.1007.214114

Package

Windows - installer (recommended)

GPU Type

Nvidia

GPU Model

Nvidia GeForce RTX 3060 Laptop GPU

GPU Driver/Mesa Version

565.90

Capture Method

Desktop Duplication API (Windows)

Config

locale = zh
lan_encryption_mode = 1
origin_web_ui_allowed = pc
channels = 2
nvenc_realtime_hags = disabled
#always_send_scancodes = disabled
keybindings = [
  0x10, 0xA0,
  0x11, 0xA2,
  0x12, 0xA4,
  0x4A, 0x4B
]

Apps

No response

Relevant log output

No relevant log output is found.
PaulFagerin commented 2 weeks ago

I have the same issues - Using sunshine with non-QWERTY keyboard is a pain, in particular for anything that needs accurate keyboard input (like coding, editing text, etc..). This is a huge drawback

puremg commented 2 weeks ago

I'm having the same issue. I tried rebinding the option and cmd key on Mac for a windows host. However the config does not work. Relevant part in sunshine.conf: keybindings = [ 0x5B, 0xA2, 0x5C, 0xA3, 0xA2, 0x5B, 0xA3, 0x5C ] However no change in behavior.

JeffSchofield commented 4 days ago

MacOS keyboard support has been generally broken for me. I have had to fix many issues in my own fork. This particular problem is due to a subtle issue with the config parser. The skip_list method consumes too many characters and will never parse the list correctly.

If you're building from source and want to fix it yourself, you can update the skip_list implementation in src/config.cpp with this:

  template <class It>
  It
  skip_list(It skipper, It end) {
      int stack = 1;
      while (skipper != end) {
          if (*skipper == '[') {
              ++stack;
          }
          if (*skipper == ']') {
              --stack;
              if (stack == 0) {
                  break;  // Stop here since we've found the matching closing bracket
              }
          }

          ++skipper;
      }

      return skipper;
  }

It works for my needs, but be warned I have not tested this on other platforms nor do I fully understand other effects this may have on other config items. I just wanted to swap Option and Command (Windows and Alt) and this was the fastest way to do that.