wirekang/mouseable

Plan for mouseable3

Opened this issue · 8 comments

Hi everybody. It's been a long time since I've neglected Mouseable. The main reason is the switch of primary OS, Windows to Ubuntu, to unify development environments with my co-workers. I tried to make Mouseable cross-platform, but failed. It seems there is no requiring api in Ubuntu or macOS. Please help me if you are expert of this kind of field.

I'm going to rewrite this problem from scratch. The new version will be on another repository. I can't say when it'll be done since I don't have enough time now.

The key points for end-user are below:

1. Drop GUI

Drop chormium based lorca and make everything file-based. Simple window will be remained for warning message, latest version prompt and error reporting.

2. Hotkey based activation

For now, Mouseable watches whole keyboard input for detect activation command. I want to change this behavior to register hotkey to operating system and do nothing until user press the hotkey. This change will increase performance, reassure the antivirus and increase posibillity for cross-platform. On the other hand it going to be impossible to activate Mouseable with non-hotkey way such as double pressing Ctrl which is my favorite 😢.

Please don't hesitate to share you opinion.

DRYN07 commented

Can you see any predictable release date yet? :)

First of all, thank you for making this. It has improved my life a lot. I use an ergo keyboard, and since nobody makes an ergo keyboard with a ThinkPad-like trackpoint/clitmouse (as far as I know), I was constantly having to switch to my mouse for some applications, which can cause elbow pain for me. Mouseable is the closest thing to a trackpoint that I have ever found.

Regarding macOS and Linux, there is already something called warpd (https://github.com/rvaiya/warpd) that works very similarly to mouseable (I also recommend 'keyd' from the same developer, which is pretty much the only good kb remapping tool for Linux that is easy to use). I've only used warpd with Linux/X11 but it supposedly works with Wayland and also on macOS, so you might want to get inspired by their code if you decide to port mouseable. They also recently released a (mostly) working Windows build, but it's still quite buggy and I prefer mouseable for daily usage.

Since I don't have the time or technical knowledge to modify the code, here are my suggestions for new features and also some bug reports:

1. Multiple bindings to the same command

I want to be able to use both WASD and HJKL to move the mouse around without the need to switch profiles. I use a similar ambidextrous setup with Vimium, and it's really helpful to reduce strain if one of your arms starts to hurt.

2. 'Click-and-turn-off' commands

With Vimium, you would usually press your 'f' key, followed by the 2 characters which would focus a text box, and then you would be able to type on the text box. I often use some applications on Windows that don't have keybindings to focus textboxes, so I'm using mouseable to focus it. However, I still have to press my 'deactivate' key right after focusing it so that I'm able to type text. I'd like to have an extra command that would work as 'press left mouse button and deactivate mouseable' (the same way that you have bindings/modifiers to open a link in a new or private tab with Vimium instead of opening in the current one, so I could use for instance 'A' for left-click, and 'Shift+A' for left-click-and-disable).

These are called 'oneshot' commands in warpd.

3. 'Drag' functionality (toggle)

Dragging things or selecting text while holding the left mouse key can put enormous strain on your hands. Ideally, we'd want a left click toggle functionality.

4. Y axis/diagonal behavior

If you are moving the cursor (with HJKL) diagonally and suddenly switch from e.g. up-right to down-right movement direction, your cursor will lose its momentum if you don't release your 'up' key before pressing your 'down' key. I think that ignoring the 'up' key as soon as you press 'down' will lead to better cursor movement. I don't know how else to describe this, but I think this is what is happening. I've developed muscle memory to avoid double pressing Y axis keys, but I think/guess that for most people the current behavior feels weird even if they don't realize what's going on. The same thing happens on the X axis if you're using WASD.

5. It shouldn't break PowerToys

However you decide to detect keypresses, it should work well with PowerToys. I'm actually impressed that the current version doesn't have any conflict with my completely remapped keyboard and even overrides my PowerToys Alt-{h,j,k,l} bindings when mouseable is active (as it should). One of the issues with warpd for Windows (this also happens with setxkbmap on Linux by the way) is that it doesn't detect Esc when it's remapped to CapsLock (I use PowerToys for this).

6. Improved pointer offset

The red square around the cursor is really hard to detect if your mouse is over the taskbar. I would place it closer to the cursor or to the right. Ideally, there would be an option to customize the offset.

7. Accelerator/decelerator modes

I actually use the sniper mode to make my cursor go faster. I think it feels better than teleporting and you can move stuff around with precision once you get used to it. However, I still would like to have a command to slow down the cursor if needed, so my suggestion is having a new command so that I can use 3 speeds (normal, slow, fast). This already exists in warpd. Speeding up also works better if you have instant acceleration, so ideally you would have an acceleration value for each mode.

8. Track for config changes and auto reload

Since the GUI doesn't work anymore for whatever reason, I was constantly modifying the config files and using a script to restart Mouseable until I found my ideal config. This can lead to a bad user experience if the user is new and still trying to make a proper config.

9. Chaining attach commands

With the latest version, if you try to use something like attach-up followed by attach-right and your bindings use a modifier like Ctrl or Alt, you have to release the modifier and press it again so that the next command works. Ideally you would be able to do this without releasing the modifier.

10. Drawing the cursor indicator after an attach command

Apparently there is a bug in the current version where the red square is not drawn right after attaching (it only is drawn again after you move a pixel). The same thing happens if for instance you press 'teleport-up' when the cursor is already near the top of the screen.

11. Inconsistent teleport behavior

This rarely happens, but sometimes the teleport-forward key stops working until you restart mouseable. This happened regardless of my config - both with WASD+H and HJKL+F. If you press teleport-forward repeatedly it will probably/eventually break.

12. Hint mode (Vimium-like)

See hint mode on warpd. It works like Vimium.

13. History mode

See history mode on warpd. Something like vim's <C-i> and <C-o> to navigate position jumplists might be useful.

14. Unclutter functionality

You could add a functionality that hides the cursor after N milliseconds, like the 'unclutter' tool for Linux.

15. Bug: sniper-mode+move-up is not working while holding left-click

It works for all other directions, though.

16. Attach offset

Instead of e.g. attaching directly to the top, attach at Y=0+{offset}. You could also set custom jump coordinates and bind it to a key.

17. AutoHotKey-like minimize shortcut to minimize windows

Windows doesn't have a dedicated command to minimize a single window. Maybe you could implement this.

18. Multi-monitor switching with vimium-like hints

See warpd to see how this is implemented. One thing that I don't like about warpd is the fact that it restricts mouse movement to the current screen. I prefer mouseable's behavior of allowing the mouse to be moved to the next screen through normal movement, but this also could be combined with screen switching hints.

Other comments

You could add keywords/tags like 'vim', 'thinkpad', 'trackpoint' to your GitHub project. This will make it easier for (some) people to find it through the GitHub search function and will probably improve SEO results as well. I found your project by random chance.

@DRYN07 I'll quit my job on early next year. The release date will be "until end of 2024".

@atlasshruggedbyaynrand Thank you very much!

DRYN07 commented

@wirekang Thank you, I will definitely follow your work :)

@wirekang Thanks a lot for making mouseable.
After reading @atlasshruggedbyaynrand's excellent suggestions I tried to implement them myself in mouseable. It all started as a fork of mouseable but then, I needed to take a different direction in the way key combinations are defined and so I created a brand new project from scratch (mousemaster).

It ended up as a mix of mouseable and warpd. It combines all the features of both tools and a few more things (mouse movements across multiple screens, hints, screen selection hints, position history hints, grid, auto-reload of the config file, custom modes, advanced key combos).

However, to achieve a high level of flexibility, I had to make the configuration file significantly more complicated than mouseable.
There are a few things to improve (like automating the build), and I just open sourced it today, so nobody else has tested it yet 😬. Still, I thought some of you might be interested. The less advanced users will find mouseable much easier and convenient to configure though.

Oh, and as mentioned in the README, it is for Windows only (10 and 11). As @wirekang found out, it seems the Linux and macOS APIs are not as flexible as the Windows API for keyboard and mouse handling, and some of the features of mouseable and mousemaster (like advanced key combos) cannot be implemented on Linux and macOS as far as I'm aware.

@petoncle Wow, very impressed. It looks great when I saw the demo(I didn't run it yet).

Well, that is interesting, if not a bit overwhelming, @petoncle.

I was also developing my own fork of mouseable since @wirekang vanished, but Go is just too annoying/verbose to understand and modify, and I wasted too much time trying to modify simple things.

I ended up writing a new port/rewrite of mouseable from scratch, which is what I should have done in the first place. It was simpler to make than what I expected, although it required some arcane knowledge of rarely-used functionality to deal with some issues (hotkey/modifier conflicts, threading and dynamic hotkeys).

Here are some improvements of neo-mousekeys when compared to mouseable:

  • Smoother mouse movement: mouse movement will be closer to your monitor's refresh rate.

  • Lower CPU usage and power draw, with customizable cycle rate. (in comparison, mouseable has CPU spikes whenever you move your mouse for some reason, even if the application is disabled and you're using your physical mouse).

  • Very low (~2MB) memory footprint. (AutoHotkey is written in C++)

  • Doesn't lock up keys when using modifiers: for example, if you use WASD for movement — while the application is enabled, you can now press Ctrl+W to close a browser tab, and Win+D to show the desktop.

  • Jumping (teleport) won't break if you spam the jump command. (fixes post on #33)

  • Edge (attach) commands won't stop working if you keep the modifier pressed down. (fixes #21)

  • Improved diagonal movement: the cursor won't suddenly stop if opposite directions are pressed. (fixes #10)

  • Improved on-screen indicator: completely customizable, doesn't disappear near edges. (fixes post on #33)

  • Activation keybinds are more flexible and follow AHK syntax. (fixes #29)

  • Allows multiple keybinds for the same functions. (partially fixes #4)

  • Simplified codebase: easier to understand, modify and build.

  • Portable by default: the keymap is read from a local options.ini file.

  • Better defaults: ergonomic/intuitive default keyboard layout.

  • For AHK users: improved/predictable interactions with other AHK scripts.

  • Support for dedicated fullscreen: provides normal pointer functionality when in fullscreen, and doesn't minimize fullscreen applications when activated.

  • No application crashes when it is set to run too early during the OS autostart/startup sequence.

  • New feature: toggle click (hold/drag) commands for all mouse buttons.

  • New feature: move cursor to the middle of the screen.

  • New feature: edge commands have an offset.

  • New feature: slow, fast and jump modes (cursor).

  • New feature: slow and fast modes for wheel scrolling.

  • New feature: custom indicators.

  • New feature: toggle slow mode (cursor & wheels).

Regarding language choices, AHK is actually the most straightforward language on Windows to implement something like this once you figure a few things out. I didn't like how other AHK implementations of mousekeys felt (you can find a bunch of them around), but it turns out that you can make something that feels as smooth as mouseable with it (or, actually, a bit smoother).

It's pretty stable at this point, and shouldn't behave weirdly or crash at all, since all system code is handled by AutoHotkey, which has been stable for a while.

I will (probably) update it a lot during this year. I don't think I'll implement hinting or anything non-minimalistic. Spamming edge commands with an offset feels way too good and I don't think hinting is going to be better than that, unless you really want to minimize physical movement for some reason.

If you're a vim user and like keyboard navigation in general, you might also want to check windows-vim-mode for a somewhat complete implementation of vim for Windows (system-wide).

Anyway, thanks for making the original version, because otherwise I wouldn't even guess you could make the mouse move smoothly like this on Windows.