From: Andre Ramnitz Date: Mon, 26 Aug 2024 10:56:36 +0000 (+0200) Subject: hypr: custom mouse acceleration X-Git-Tag: v0.2~120 X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=3bdd68eb7c5cd0e6907320e5c5f85020dc10b531;p=dotfiles.git hypr: custom mouse acceleration --- diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index 2f0d3dfc..3a7ffc33 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -38,10 +38,10 @@ env = SDL_VIDEODRIVER,wayland # remove or set to x11 for games providing older v # env = WLR_DRM_NO_ATOMIC,0 # set cursor -env = XCURSOR_THEME,breeze -env = XCURSOR_SIZE,30 -env = HYPRCURSOR_THEME,Bibata-Modern-Amber -env = HYPRCURSOR_SIZE,30 +env = XCURSOR_THEME,BreezeX-Black +env = XCURSOR_SIZE,40 +env = HYPRCURSOR_THEME,rose-pine-hyprcursors +env = HYPRCURSOR_SIZE,40 # Execute your favorite apps at launch exec-once = hyprpm enable hyprbars @@ -159,9 +159,11 @@ misc { # Example per-device config # See https://wiki.hyprland.org/Configuring/Keywords/#executing for more -# device:epic-mouse-v1 { -# sensitivity = -0.5 -# } +device { + name = razer-razer-basilisk-v3 + sensitivity = 0 + accel_profile = custom 0.3431164009 0.000 0.291 0.582 1.019 1.456 1.894 2.370 3.035 3.700 4.364 5.029 5.694 6.358 7.023 7.688 8.353 9.017 9.682 10.347 11.720 +} group { insert_after_current = false diff --git a/local/bin/accel.py b/local/bin/accel.py new file mode 100755 index 00000000..a78d2ca0 --- /dev/null +++ b/local/bin/accel.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python3 + +# original at https://gist.github.com/yinonburgansky/7be4d0489a0df8c06a923240b8eb0191 +# modified for ease of use in Hyprland + +# calculation are based on http://www.esreality.com/index.php?a=post&id=1945096 +# assuming windows 10 uses the same calculation as windows 7. +# guesses have been made calculation is not accurate +# touchpad users make sure your touchpad is calibrated with `sudo libinput measure touchpad-size` +# import matplotlib.pyplot as plt +import struct +import os +import sys + +# set according to your device: +device_dpi = 1600 # mouse dpi +screen_dpi = 109 +screen_scaling_factor = 1 +sample_point_count = 20 # should be enough but you can try to increase for accuracy of windows function +sensitivity_factor = 5 +# sensitivity factor translation table: (windows slider notches) +# 1 = 0.1 +# 2 = 0.2 +# 3 = 0.4 +# 4 = 0.6 +# 5 = 0.8 +# 6 = 1.0 default +# 7 = 1.2 +# 8 = 1.4 +# 9 = 1.6 +# 10 = 1.8 +# 11 = 2.0 + +def findArg(arg): + for i in sys.argv: + if i == arg: + return True + + return False + + +if findArg("help") or findArg("-h") or findArg("--help"): + print(f'{sys.argv[0]} [[accel_device] [scroll_points] device=]') + print('To get the device, run `hyprctl devices`') + exit(0) + +# TODO: find accurate formulas for scale x and scale y +# mouse speed: inch/s to device-units/millisecond +scale_x = device_dpi / 1e3 +# pointer speed: inch/s to screen pixels/millisecond +scale_y = screen_dpi / 1e3 / screen_scaling_factor * sensitivity_factor + +print(f'scale_x={scale_x}, scale_y={scale_y}') + + +def float16x16(num): + return struct.unpack('