Smart Input, which intercepts your keystrokes and will help you type less, faster, and adds foresight.
Even though we're trying to start from making the keyboard smarter, but the goal of the project is to help the computer know what the user wants and just help them do it and also give the user a situational awareness of the system they're using.
Currently, only Linux is supported; the project is still a work in progress.
- Programming input devices to match your needs and wants.
- Automation
- Quick Actions
- Creating models of your habits to predict the correct actions
- A personal assistance that lets you focus and gives you the right information at the right time
- Connecting related tools to create useful pipelines of actions
- Adding features to software that don't support them yet
- Do all of these things while considering "Privacy"
- To be used as a library as well
I understand these are far-fetched goals, but we can't get there if we don't try.
| Feature Name | Description | Status |
|---|---|---|
| Intercept | Intercept the input events and print them | ✅ |
| > Redirect | Read the input events from stdin, and write them to the event files | ✅ |
| > Common interceptors | Common interceptors for use with intercept | ... | redirect |
✅ |
| > Ignore big jumps | Ignore big mouse jumps | ✅ |
| > Ignore Starting moves | Ignore starting moves of a mouse | ✅ |
| > Ignore fast repeats | Ignore fast repeats of input events | ✅ |
| > Ignore events completely | Ignore some events completely (mostly used conditionally) | ✅ |
| > Ignore adjacent repeats | Ignore duplicated events (mostly happen by mistake) | ✅ |
| > ABS to REL | Convert absolute events (drawing tablets) to relative events (mouse) | ✅ |
| > Add Scrollbar | Convert mouse movements into scroll wheel (conditionally) | ✅ |
| > Replace events | Convert events into other events. | ✅ |
| > Route events | Route events into different output devices | ✅ |
| Device Info | List kernel event devices (like evtest) | ❌ |
| String Matching | Figure out what the using is typing/editing right now | ❌ |
| Regular Expression | Use RegExp to find and replace selected/typing strings | ❌ |
| Auto-complete | Auto complete the user input | ❌ |
| Auto-correct | Auto correct | ❌ |
| Number Scroll | Shortcut + Scroll-wheel to update the number/date/color/... | ❌ |
| Shell cmds | Run shell commands (for eg: $ whoami <ctrl-enter>) |
✅ |
| Software Detection | Detect which app the user's in, so we can use custom commands | ❌ |
| Clang Tools | Use clang tools to rename variables, show assembly, ... | ❌ |
| Config File | Custom config file to customize by the user | ❌ |
| GUI | Graphical User Interface for ease of use | ❌ |
| Remote Input | Remotely control the keyboard and mouse (sharing keyboard & mouse) | ❌ |
| Auto translate | Translate the input while typing | ❌ |
| Keyboard re-mapping | Remap any input to another or a combinations of others | ✅ |
| Unicode Support | Emojis, ... | ❌ |
| Macros | Register a sequence of keys, and re-run them as needed | ❌ |
| Modes and Layers | Like vim modes | ❌ |
| Audio | Add audio support for when events happen, we can configure special audio | ❌ |
| Network Packet Matching | Fire events on network packets (use case: beep on loading ads) | ❌ |
| Habits | Machine-Learning based event-habit calculator | ❌ |
| > Anomaly Notifier | Machine-Learning based anomaly notifier based on habits | ❌ |
Examples like pen2mice will convert Drawing Tablet events into Mouse Events plus some other features like adding scroll wheel to it. Foresight is designed in a way so it can be used as a library.
But this foresight binary itself can be used like this:
Usage: foresight [options] [action]
arguments:
-h | --help Print help.
actions:
intercept [files...] Intercept the files and print everything to stdout.
-g | --grab Grab the input.
Stops everyone else from using the input.
Only use this if you know what you're doing!
redirect [files...] Redirect stdin to the specified files.
help Print help.
Example Usages:
$ keyboard=/dev/input/event1
$ foresight intercept -g $keyboard | x2y | foresight redirect $keyboard
----------------------------- --- ----------------------------
| | |
| | |
| | |
| | |
`----> Intercept the input | `---> put the modified input back
/
/
/
-----------------------
/
$ cat x2y.c # you can do it with any programming language you like
#include <stdio.h>
#include <stdlib.h>
#include <linux/input.h>
int main(void) {
setbuf(stdin, NULL); // disable stdin buffer
setbuf(stdout, NULL); // disable stdout buffer
struct input_event event;
// read from the input
while (fread(&event, sizeof(event), 1, stdin) == 1) {
// modify the input however you like
// here, we change "x" to "y"
if (event.type == EV_KEY && event.code == KEY_X)
event.code = KEY_Y;
// write it to stdout
fwrite(&event, sizeof(event), 1, stdout);
}
}
Partially inspired by these projects: