debauchee / barrier

Open-source KVM software
Other
27.51k stars 1.51k forks source link

Enhancement: Allow mouse speed scaling for clients with dissimilar DPI #741

Open hovissimo opened 4 years ago

hovissimo commented 4 years ago

Operating Systems

Server: N/A (Windows 10 1809)

Client: N/A (Ubuntu 20.04)

Barrier Version

2.2.0 installed via apt

Steps to reproduce bug

In my specific scenario my server's single display is 2560x1440 and the client's single display is 3840x2160. The mouse "feels" way too slow on the client, assumably because the mouse updates are done in screen pixels. This issue is an enhancement request for mouse position scaling. MVP would be a client parameter configured on the server, but hopefully a conversion factor could be figured (and maybe enabled?) automatically.

Other info

195 is related.

linaori commented 4 years ago

Today I forgot to bring home my display port to dvi converter. I can't stare at my laptop screen, it's too small. I tried fractional scaling on Ubuntu 20.04 with barrier and it turns out that my mouse becomes slow on the client. Changing the mouse speed doesn't work, it remains slow. This makes fractional scaling unusable for me :(

aaronjensen commented 4 years ago

I ran into the opposite problem. The mouse was too fast on the client. Luckily, my server is linux, so I set up barrier to log to /tmp/barrier.log and then I run the below script. You should be able to tweak the speeds to your liking. Note that you'll need to plug in your mouse and speed property. You may be able to do a similar thing with Windows or macOS as the server if you know how to change the mouse speed via the shell.

#!/usr/bin/env bash
set -eu

# Find with: xinput --list --short
mouse="Kingsis Peripherals Evoluent VerticalMouse D"
# Find with: xinput --list-props $mouse
speed_property="libinput Accel Speed"
server_mouse_speed=0.252669
client_mouse_speed=-0.743772

function finish {
  xinput --set-prop "$mouse" "$speed_property" "$server_mouse_speed"
}
trap finish EXIT

tail -F -n0 /tmp/barrier.log | while read line
do
  if [[ "$line" == *"leaving screen" ]]; then
    xinput --set-prop "$mouse" "$speed_property" "$client_mouse_speed"
  elif [[ "$line" == *"entering screen" ]]; then
    xinput --set-prop "$mouse" "$speed_property" "$server_mouse_speed"
  fi
done
hovissimo commented 4 years ago

@aaronjensen That hack is evil and I love it. Regretfully, I have to have the server running on the Windows machine and I'm not feeling bullish about scripting mouse speeds on Windows.

jyavorska commented 4 years ago

Would love this, my barrier host is on 1080p and my client is 4k so the mouse moves very slow on the client.

yangshao commented 4 years ago

I have the same issue, the mouse on the client(mac) is too fast and i'm on the windows server, hope to see some updates soon.

mono424 commented 4 years ago

+1 mouse speed settings per client would be awesome 💯

psignoret commented 4 years ago

@hovissimo I've ported @aaronjensen's wonderful hack to PowerShell: https://gist.github.com/psignoret/32cecc507fba2508d05f4672fe52eeb2. Example usage:

.\BarrierMouseSpeedFix.ps1 -ClientMouseSpeed 3 -LogFile "C:\tmp\barrier.log"
mathdone commented 4 years ago

I ran into the opposite problem. The mouse was too fast on the client. Luckily, my server is linux, so I set up barrier to log to /tmp/barrier.log and then I run the below script. You should be able to tweak the speeds to your liking. Note that you'll need to plug in your mouse and speed property. You may be able to do a similar thing with Windows or macOS as the server if you know how to change the mouse speed via the shell.

#!/usr/bin/env bash
set -eu

# Find with: xinput --list --short
mouse="Kingsis Peripherals Evoluent VerticalMouse D"
# Find with: xinput --list-props $mouse
speed_property="libinput Accel Speed"
server_mouse_speed=0.252669
client_mouse_speed=-0.743772

function finish {
  xinput --set-prop "$mouse" "$speed_property" "$server_mouse_speed"
}
trap finish EXIT

tail -F -n0 /tmp/barrier.log | while read line
do
  if [[ "$line" == *"leaving screen" ]]; then
    xinput --set-prop "$mouse" "$speed_property" "$client_mouse_speed"
  elif [[ "$line" == *"entering screen" ]]; then
    xinput --set-prop "$mouse" "$speed_property" "$server_mouse_speed"
  fi
done

I added an extra:

 elif [[ "$line" == *"can't leave screen" ]]; then
    xinput --set-prop "$mouse" "$speed_property" "$server_mouse_speed"

because gnome will trap the cursor when i'm interacting with the interface. It takes a little less then a second to work, tho.

gwillen commented 3 years ago

I, too, love this terrible hack. Does anybody have an equivalent one for when the server is running on macOS?

MANTENN commented 3 years ago

I, too, love this terrible hack. Does anybody have an equivalent one for when the server is running on macOS?

What's your client device? I am using ubuntu as the client and I have macOS as the server. You only need to adjust the speed on the client to make it consistent. The script doesn't work for me on ubuntu had to make some changes.

It runs and adjusts the property values but I am not seeing the changes with the UI.

MANTENN commented 3 years ago

I ran into the opposite problem. The mouse was too fast on the client. Luckily, my server is linux, so I set up barrier to log to /tmp/barrier.log and then I run the below script. You should be able to tweak the speeds to your liking. Note that you'll need to plug in your mouse and speed property. You may be able to do a similar thing with Windows or macOS as the server if you know how to change the mouse speed via the shell.

#!/usr/bin/env bash
set -eu

# Find with: xinput --list --short
mouse="Kingsis Peripherals Evoluent VerticalMouse D"
# Find with: xinput --list-props $mouse
speed_property="libinput Accel Speed"
server_mouse_speed=0.252669
client_mouse_speed=-0.743772

function finish {
  xinput --set-prop "$mouse" "$speed_property" "$server_mouse_speed"
}
trap finish EXIT

tail -F -n0 /tmp/barrier.log | while read line
do
  if [[ "$line" == *"leaving screen" ]]; then
    xinput --set-prop "$mouse" "$speed_property" "$client_mouse_speed"
  elif [[ "$line" == *"entering screen" ]]; then
    xinput --set-prop "$mouse" "$speed_property" "$server_mouse_speed"
  fi
done

For Snap Packages you will need to run the script as admin.

#!/usr/bin/env bash
set -eu

# Find with: xinput --list --short
mouse="PS/2 Logitech Wheel Mouse"
# Find with: xinput --list-props $mouse
speed_property="libinput Accel Speed"
server_mouse_speed=0.752669
client_mouse_speed=-0.743772

function finish {
  xinput --set-prop "$mouse" "$speed_property" "$server_mouse_speed"
}
trap finish EXIT

tail -F -n0 /tmp/snap.barrier/tmp/barrier.log | while read line
do
  if [[ "$line" == *"leaving screen" ]]; then
    echo "setting mouse speed back to normal"
    xinput --set-prop "$mouse" "$speed_property" "$client_mouse_speed"
  elif [[ "$line" == *"entering screen" ]]; then
    echo "setting mouse speed to server"
    xinput --set-prop "$mouse" "$speed_property" "$server_mouse_speed"
  fi
done

Make it executable chmod +x ~/barrier.sh

Alexey-Tsarev commented 2 years ago

Better idea is implement something like an option in a client's settings. Something like - mouse movement coefficient. By default it's 1. If someone wants twice speed, then the value is 2. And the opposite, if mouse speed is too fast, then 0.5.