CharaChorder / CCOS-firmware

CharaChorder Operating System
17 stars 1 forks source link

Enhancement: Accelerating mouse pointer #99

Open duianto opened 2 months ago

duianto commented 2 months ago

Is your feature request related to a problem? Please describe.

Fixed mouse speeds often feels too fast or too slow.

Describe the solution you'd like

Accelerate the mouse pointer the longer a mouse move key is held. This also allows for more precision, by only moving the pointer a couple of pixels by tapping the mouse move keys.

Additional context

Windows users can try it with this AutoHotkey script that accelerates the mouse pointer, the longer a key is held.

Note

Remap the keys you want to move the mouse to f13 to f16:

   f14
f13   f15
   f16

If you want to use other keys, change the bindings below.

Note 2

In Windows 10 pressing win + f16, dims the screen and an image slides down from the top of the screen with the text: Slide to shut down your PC Pressing Esc slides up (cancels) the message. If you often hold win and move mouse down, remap f16 to f17 or something else.

#Requires AutoHotkey v2.0

; milliseconds, 1 or greater, smaller is faster
mouseMoveTimerDelay := 16

MouseSpeedResetX()
MouseSpeedResetY()

*f13::startMouseMoveLeft()
*f13 up::stopMouseMoveLeft()

*f14::startMouseMoveUp()
*f14 up::stopMouseMoveUp()

*f15::startMouseMoveRight()
*f15 up::stopMouseMoveRight()

; note: `win f16` shows a windows 10 message: slide to shutdown
*f16::startMouseMoveDown()
*f16 up::stopMouseMoveDown()

startMouseMoveLeft()
{
    if mouseSpeedX == 0
    {
        SetTimer mouseMoveLeft, mouseMoveTimerDelay
    }
}

mouseMoveLeft()
{
    global mouseSpeedX
    mouseSpeedX -= 1
    mousemove mouseSpeedX, mouseSpeedY, 0, "R"
}

stopMouseMoveLeft()
{
    MouseSpeedResetX()
    SetTimer mouseMoveLeft, 0
}

startMouseMoveRight()
{
    if mouseSpeedX == 0
    {
        SetTimer mouseMoveRight, mouseMoveTimerDelay
    }
}

mouseMoveRight()
{
    global mouseSpeedX
    mouseSpeedX += 1
    mousemove mouseSpeedX, mouseSpeedY, 0, "R"
}

stopMouseMoveRight()
{
    MouseSpeedResetX()
    SetTimer mouseMoveRight, 0
}

startMouseMoveUp()
{
    if mouseSpeedY == 0
    {
        SetTimer mouseMoveUp, mouseMoveTimerDelay
    }
}

mouseMoveUp()
{
    global mouseSpeedY
    mouseSpeedY -= 1
    mousemove mouseSpeedX, mouseSpeedY, 0, "R"
}

stopMouseMoveUp()
{
    MouseSpeedResetY()
    SetTimer mouseMoveUp, 0
}

startMouseMoveDown()
{
    if mouseSpeedY == 0
    {
        SetTimer mouseMoveDown, mouseMoveTimerDelay
    }
}

mouseMoveDown()
{
    global mouseSpeedY
    mouseSpeedY += 1
    mousemove mouseSpeedX, mouseSpeedY, 0, "R"
}

stopMouseMoveDown()
{
    MouseSpeedResetY()
    SetTimer mouseMoveDown, 0
}

MouseSpeedResetX()
{
    global mouseSpeedX
    mouseSpeedX := 0
}

MouseSpeedResetY()
{
    global mouseSpeedY
    mouseSpeedY := 0
}