-
-
Notifications
You must be signed in to change notification settings - Fork 40.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mousegrid: implement grid-based mouse navigation
Add 2 modes of "grid-based" mouse cursor movement schemes: 1. Specifying an absolute x-y coordinate using 26-character alphabet 2. Iteratively picking a 3x3 direction to zoom in towards Both of these pose as an absolute positiong digitizer.
- Loading branch information
Showing
10 changed files
with
649 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"keycodes": { | ||
"0x00E8": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_TOP_LEFT", | ||
"label": "Select top left mouse grid", | ||
"aliases": [ | ||
"MG_TL" | ||
] | ||
}, | ||
"0x00E9": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_TOP", | ||
"label": "Select top mouse grid", | ||
"aliases": [ | ||
"MG_T" | ||
] | ||
}, | ||
"0x00F0": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_TOP_RIGHT", | ||
"label": "Select top right mouse grid", | ||
"aliases": [ | ||
"MG_TR" | ||
] | ||
}, | ||
"0x00F1": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_LEFT", | ||
"label": "Select left mouse grid", | ||
"aliases": [ | ||
"MG_L" | ||
] | ||
}, | ||
"0x00F2": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_CENTER", | ||
"label": "Select center mouse grid", | ||
"aliases": [ | ||
"MG_C" | ||
] | ||
}, | ||
"0x00F3": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_RIGHT", | ||
"label": "Select right mouse grid", | ||
"aliases": [ | ||
"MG_R" | ||
] | ||
}, | ||
"0x00F4": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_BOTTOM_LEFT", | ||
"label": "Select bottom left mouse grid", | ||
"aliases": [ | ||
"MG_BL" | ||
] | ||
}, | ||
"0x00F5": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_BOTTOM", | ||
"label": "Select bottom mouse grid", | ||
"aliases": [ | ||
"MG_B" | ||
] | ||
}, | ||
"0x00F6": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_BOTTOM_RIGHT", | ||
"label": "Select bottom right mouse grid", | ||
"aliases": [ | ||
"MG_BR" | ||
] | ||
}, | ||
"0x00F7": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_RESET", | ||
"label": "Reset mouse grid cursor", | ||
"aliases": [ | ||
"MG_RST" | ||
] | ||
}, | ||
"0x00F8": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_ANIMATE", | ||
"label": "Visualize mouse grid options", | ||
"aliases": [ | ||
"MG_ANIM" | ||
] | ||
}, | ||
"0x00F9": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_UNDO", | ||
"label": "Undo a mousegrid move", | ||
"aliases": [ | ||
"MG_UNDO" | ||
] | ||
}, | ||
"0x00FA": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_ALPHABET", | ||
"label": "Initiate an alphabet mousegrid move", | ||
"aliases": [ | ||
"MG_ABC" | ||
] | ||
}, | ||
"0x00FB": { | ||
"group": "mousegrid", | ||
"key": "QK_MOUSE_GRID_NEAR", | ||
"label": "Reset cursor scale for local movement", | ||
"aliases": [ | ||
"MG_NEAR" | ||
] | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Mouse grid | ||
|
||
Mouse grid is a feature for quickly positioning the mouse cursor using coordinate or grid based methods. | ||
|
||
### Enabling mouse grid | ||
|
||
To enable mouse grid, add the following line to your keymap’s `rules.mk`: | ||
|
||
```c | ||
MOUSEGRID_ENABLE = yes | ||
``` | ||
|
||
## Alphabet-based coordinates | ||
|
||
One of the methods is to divide the screen into a 26x26 grid and position the mouse by inputting 2 characters for coordinates. | ||
|
||
This is triggered by `QK_MOUSE_GRID_ALPHABET` (or `MG_ABC`) key that will wait for a few seconds for 2 keypresses that will be interpreted as characters specifying the coordinates where to place the mouse. | ||
|
||
That is, when pressing `MG_ABC`, `KC_M`, `KC_P`, the mouse would be positioned: | ||
|
||
| |A|B|C|…|L|M|N|…|X|Y|Z| | ||
|-|-|-|-|-|-|-|-|-|-|-|-| | ||
|A| | | | | | | | | | | | | ||
|B| | | | | | | | | | | | | ||
|C| | | | | | | | | | | | | ||
|…| | | | | | | | | | | | | ||
|O| | | | | | | | | | | | | ||
|P| | | | | |X| | | | | | | ||
|R| | | | | | | | | | | | | ||
|…| | | | | | | | | | | | | ||
|X| | | | | | | | | | | | | ||
|Y| | | | | | | | | | | | | ||
|Z| | | | | | | | | | | | | ||
|
||
## Repeated directional grid | ||
|
||
The other method works by repeatedly picking from a 3x3 grid to repeatedly zoom in towards the desired cursor position. | ||
|
||
This is triggered by `QK_MOUSE_GRID_RESET` (or `MG_RST`) to center the cursor and then repeatedly picking one of the 9 positions in the grid: | ||
|
||
| |-1 |0 |+1 | | ||
|--|-------|------|-------| | ||
|-1|`MG_TL`|`MG_T`|`MG_TR`| | ||
|0 |`MG_L` |`MG_C`|`MG_R` | | ||
|+1|`MG_BL`|`MG_B`|`MG_BR`| | ||
|
||
In first interation, the whole screen is divided into a 3x3 grid to pick from, while second iteration picks within the 3x3 subgrid of the "quadrant" picked in the first iteration. | ||
|
||
Since the "quadrants" are not visualized on screen while navigating, if a movement target is kind of between two quadrants, it can be difficult to tell which one is the "correct" coordinate. | ||
|
||
In order to be forgiving of some inaccuracy, the default configuration leaves a little bit of buffer by zooming in slightly less than would be required for the 1/9th of the "quadrant". This means that for slightly inaccurate path can still reach the target but may require an extra keystroke. | ||
|
||
While practicing, `QK_MOUSE_GRID_ANIMATE` (or `MG_ANIM`) can be pressed to cause the cursor to quickly jump through all the 9 positions of each quadrant choice. Additionally, `QK_MOUSE_GRID_UNDO` (or `MG_UNDO`) can be used to undo the last quadrant choice. | ||
|
||
## Precision | ||
|
||
On a 1920x1080 screen an alphabet of 26 characters divides the screen into grid of ~75x50 rectangles. This can be enough for larger UI elements (eg: browser tabs) but to accurately point at dense UI elements (eg: menu items). | ||
|
||
On a 1920x1080 screen it takes 4 iterations of 3x3 grid to point at a grid of ~35x20 rectangles, which allows pointing at event relatively small UI elements, like menu items. | ||
|
||
Both grid methods can combined, but for fine adjustments it may be better to use the mouse keys feature. | ||
|
||
However, the `QK_MOUSE_GRID_NEAR` (or `MG_NEAR`) key can be used to to zoom out the cursor tot he local area, so that next keystrokes would allow move to a nearby UI element faster, without resetting to the center of the screen. | ||
|
||
## Mouse grid keycodes | ||
|
||
Full list of mouse grid keycodes: | ||
|
||
|Key |Alias |Description | | ||
|----------------------------|---------|------------------------------------------------| | ||
|`QK_MOUSE_GRID_ALPHABET` |`MG_ABC` |Position cursor according to alphabet-based grid| | ||
|`QK_MOUSE_GRID_RESET` |`MG_RST` |Reset cursor to the center of the screen | | ||
|`QK_MOUSE_GRID_TOP_LEFT` |`MG_TL` |Pick top-left quadrant | | ||
|`QK_MOUSE_GRID_TOP` |`MG_T` |Pick top quadrant | | ||
|`QK_MOUSE_GRID_TOP_RIGHT` |`MG_TR` |Pick top-right quadrant | | ||
|`QK_MOUSE_GRID_LEFT` |`MG_L` |Pick left quadrant | | ||
|`QK_MOUSE_GRID_CENTER` |`MG_C` |Pick center quadrant | | ||
|`QK_MOUSE_GRID_RIGHT` |`MG_R` |Pick right quadrant | | ||
|`QK_MOUSE_GRID_BOTTOM_LEFT` |`MG_BL` |Pick bottom-left quadrant | | ||
|`QK_MOUSE_GRID_BOTTOM` |`MG_B` |Pick bottom quadrant | | ||
|`QK_MOUSE_GRID_BOTTOM_RIGHT`|`MG_BR` |Pick bottom-right quadrant | | ||
|`QK_MOUSE_GRID_ANIMATE` |`MG_ANIM`|Quickly move the cursor through all quadrants | | ||
|`QK_MOUSE_GRID_UNDO` |`MG_UNDO`|Undo last quadrant pick | | ||
|`QK_MOUSE_GRID_NEAR` |`MG_NEAR`|Zoom cursor to local/nearby quadrant navigation | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.