Git Product home page Git Product logo

4strid / mouse-control.autohotkey Goto Github PK

View Code? Open in Web Editor NEW
78.0 4.0 16.0 1.52 MB

AutoHotKey script for controlling the mouse with the keyboard. Fast & easy-to-use, full-fledged software replacement for a physical mouse. WASD / vim movement and vim-inspired key bindings. Better alternative to Numpad Mouse.

License: MIT License

AutoHotkey 100.00%
autohotkey vim-inspired mouse mouse-emulation accessibility easy-to-use keyboard-shortcuts wasd-controls power-user keyboard-mouse

mouse-control.autohotkey's Introduction

mouse-control.autohotkey

AutoHotkey script with Vim (and now also WASD!) bindings to control the mouse with the keyboard

Why use a mouse control script?

This is my implementation of a hardware mouse, in software. As of 2023 I believe it has full feature parity with an actual mouse, and has been optimized by daily use for several years. Whatever your reasons for trying to drive the mouse with the keys, this is my very best attempt at creating a program to do so, and I hope you find it as pleasant and convenient to use as I do.

Installation

Download the script and binary by cloning this repository from GitHub. The command to run is

git clone [email protected]:4strid/mouse-control.autohotkey.git

If that sentence makes no sense to you at all, no worries! Simply download the repository as a zip file, unzip it, and run the included executable mouse-control.exe :>

The benefit to using git is you can keep up to date with git pull. I'm still (periodically) pushing little updates here and there to make it better and easier to use.

Precompiled Binary

As of the latest release, a precompiled version is shipped with the source code so you don't have to install anything at all. Just double click the .exe and you're gucci golden! (It's the one with a cute little mouse icon) (Well, I think it's cute; I'm not much of an artist, admittedly)

Running from Source

You should run this script from source; never trust binaries you just find lying around on the Internet, even if it's from a trustworthy source like yours truly :^)

To run it you'll need to install AutoHotkey first. Then you should be able to double click the .ahk file to run the script. Pretty easy right?

AS OF (WHENEVER IT WAS) AHK has updated to "Version 2.0"

Luckily it turns out, you can install either version 1.1 or 2.0, as when you try to run mouse-control.ahk in Version 2, it will happily download the old version and run it appropriately.

Modes of Input

This program has modes of input, allowing the keys to sometimes drive the mouse, and sometimes drive the keyboard (inspired by the text editor Vim). There's "Insert mode" where the keys behave normally and "Normal mode" intercepting keys to move and control the mouse instead. (These names are lifted from Vim. I'm aware, "Normal" mode isn't very normal at all)

Home or Win Alt n enters Normal mode Insert or Win Alt i enters Insert mode

Normal mode

  • hjkl move the mouse
  • HJKL jump to edges of the screen
  • M jump to center of the screen
  • i left click
  • o right click
  • p middle click
  • v hold down left click (hit v or any mouse button again to release)
  • z hold down right click (hit z or any mouse button again to release)
  • c hold down middle click (hit c or any mouse button again to release)
  • e,0,] scroll down
  • y,9,[ scroll up
  • d,} scroll down faster
  • u,{ scroll up faster
  • Y "yank" a window (reposition it) (press i to release)
  • b "back" mouse button
  • n "forward" mouse button
  • Insert,Win+Alt+i enter Insert mode

Normal "WASD" mode

You can also use the WASD keys if they're more natural to you than vim movement keys. Switch into and out of WASD mode with Win Alt r

WASD mode is now the default for Normal mode.

  • wasd move the mouse
  • WASD jump to edges of the screen
  • C jump to center the screen
  • r left click
  • t right click
  • y middle click
  • e scroll down
  • q scroll up

Note that this necessarily unbinds d e and y from their Vim bindings. The rest of the hotkeys remain unchanged.

Insert mode

Acts like a normal keyboard.

Home and Win Alt n put you in Normal mode.

Normal "Quick" mode

If you're in persistent Insert mode and just need the mouse keys for a second, you can hold down Capslock to enter Normal "Quick" mode, which has all the same hotkeys as Normal mode and ends when Capslock is released.

Insert "Quick" mode

To quickly edit some text then return to Normal mode, a "quick" mode is also available for Insert. Great for typing into an address bar or a form field. Capslock toggles between Normal and quick Insert mode.

Entering

From Normal mode

  • : enter QI (Quick Insert mode)
  • Capslock toggle between QI and Normal mode
  • f send f then enter QI (for Vimium hotlinks)
  • ^f send ctrl f then enter QI (commonly "search")
  • ^t send ctrl t then enter QI (new tab in the browser)
  • Delete send Delete then enter QI (for quick fixes)
Exiting

From quick Insert mode:

  • ^c exit to Normal mode
  • Enter send Enter then exit to Normal mode
  • Capslock toggle between Quick Insert and Normal mode

Home enters Normal mode Insert enters regular (persistent) Insert mode

Last Remarks

Alternative to Numpad Mouse

I am aware of the Numpad Mouse feature included in Windows, and consider this a Massive improvement over the builtin functionality. I'll say that again, for search optimization, This is an alternative to Numpad Mouse with considerably better usability, and additional functionality. It is a faster and more convenient alternative to Numpad Mouse.

For Vim Purists

"Why doesn't i take me into Insert mode and Escape put me in Normal mode! >:U"

I made i left click. You've got Win Alt i which is a nice and unintrusive variant of i. We didn't even used to have that when Win Alt was part of Quick modes so there you go.

Escape is too useful a key to bind to anything. It was infuriating to hit Escape and not have the expected effect so I took it out.

~ Sorry, nerds :^)

"How come I can't make my own keybindings >:I"

I like these ones. You can fork the repo to make your own, or make a pull request if you want to set up managing an ini file :^)

The mouse moves too fast! (or too slow)

At the top of the file, mouse speed is controlled by two global variables, FORCE and RESISTANCE. FORCE controls acceleration and RESISTANCE causes diminishing returns and implicitly creates a terminal velocity.

Use the uncompiled .ahk script and you can change these to taste.

Contact

Bug reports, questions, feature requests, and pull requests are all welcome. Just open an issue on Github. (Or email me ! Don't be shy I'm really nice)

mouse-control.autohotkey's People

Contributors

4strid avatar eneshhs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mouse-control.autohotkey's Issues

make key combinations customizable

Some already rebind CapsLock for other autohotkey scripts, or use it as Escape, Control key, or both. Therefore, the used mappings could be set at the start of the AHK file.

Smoother Mouse Pointer Movement

Is there a way to make is as smooth as using a mouse? could this be a keyboard polling rate issue?
Anyways I'm in love with this, tysm for making it

Please add Hold Middle Mouse Button

Please add a hold middle mouse button. I really need it for a Window arrangement script that I like to use. It also doesn't help that that MMB on every mouse is always the first to fail. For some reason, literally every single mouse manufacturer insists on using a subpar switch for the Scroll Wheel Button.


Thank you for your work on this script, @4strid. Seriously.
When I was disabled and bedridden due to an injury, your script(along with a couple of android apps) helped me operate my computer while I lay in bed without me having to strain myself reaching for the mouse every time. I've recovered now, and your script still continues to help me avoid pain.

Sincerely, Thank you. So...so much.

I would give you money if I could but sadly I can't, so I hope you find these words somewhat comforting.

I wish you the very best. And may life be kind to you @4strid .

Thank you!

hardware mouse emulator

Hi. Can I use this like "hardware mouse emulator"? I try
Send, {Home} to switch normal mode
and
Send i to click,
but it not works.

on extended second screen stuck in lower edge

On a single screen your application works wonderfully, but once the mouse cursor reaches another extended screen it goes downwards to the edge of the screen and is stuck there; no way to move the cursor anymore in normal mode.

ToggleInsert/NormalMode

Could a single key combination be bound to switch between Insert and Normal mode? Say Ctrl+; like Keynav does.

different message box style

Hi Astrid!

I want to change the position of the message box (down left with a bit of margin), and change up the style so it matches my Windows 11 "Sound-Change-Notification":
image
Also, I'm curious, how does your project work?
I can't seem to identify what programming language you used, but my wild guess is that it's C??
Does the .exe file read the .ahk file as a configuration file?

Kind regards,
Automaetic

Start in normal mode

I've tried to launch mouse-control.ahk
in windows but nothing
in linux nothing too
i think to create shortcut with variable ...
Can anyone help me ...
Thank's in advance

Release key after Drag function

I couldn't find a way to release the mouse button after using the drag function (press v).
In the code I read a comment on line 422 informing that this could be implemented in the future.

Is there an estimated date for this implementation?

obs: thanks for the scriipt. Help me a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.