Skip to content

Commit

Permalink
Various Changes
Browse files Browse the repository at this point in the history
- Horizontal scrolling was added
- discrete mode has been renamed 'normal mode' (along with all corresponding options)
- The default behaviour is now modal (see `oneshot_mode` and `normal_hint_key`)
- Some default bindings were changed (see the man page)
- Stability fixes
  • Loading branch information
rvaiya committed Oct 11, 2020
1 parent 0dff1f0 commit 65e8cd6
Show file tree
Hide file tree
Showing 18 changed files with 630 additions and 538 deletions.
2 changes: 1 addition & 1 deletion Makefile
@@ -1,7 +1,7 @@
CC=gcc
CFLAGS=-lXfixes -lXext -lXi -lXtst -lX11 -lXft -I/usr/include/freetype2 -DCOMMIT=\"$(shell git describe --no-match --always --abbrev=40 --dirty)\" -o bin/warpd -Wall -Wextra

SRC=src/cfg.c src/input.c src/hint_drw.c src/discrete.c src/grid.c src/hints.c src/dbg.c src/scroll.c src/main.c
SRC=src/cfg.c src/input.c src/hint_drw.c src/normal.c src/grid.c src/hints.c src/dbg.c src/scroll.c src/main.c

all:
-mkdir bin
Expand Down
26 changes: 14 additions & 12 deletions README.md
@@ -1,6 +1,6 @@
# Overview

A small X program which provides different mechanisms for manipulating the cursor using the keyboard. The program was originally inspired by the mousekeys feature of Kaleidoscope, the firmware for the Keyboardio.
A small X program which provides a modal keyboard driven interface for cursor manipulation. The program was originally inspired by the mousekeys feature of Kaleidoscope, the firmware for the Keyboardio.

# Installation

Expand All @@ -26,7 +26,7 @@ sudo apt-get install libxi-dev libxinerama-dev libxft-dev libxfixes-dev libxtst-
<img src="demo_warp.gif" height="400px"/>
</p>

## Discrete Mode
## Normal Mode

<p align="center">
<img src="demo_discrete.gif" height="400px"/>
Expand All @@ -37,22 +37,24 @@ sudo apt-get install libxi-dev libxinerama-dev libxft-dev libxfixes-dev libxtst-

1. Run `warpd`

## Hint Mode
2. Press `M-x` to generate a list of hints
3. Enter the key sequence associated with the desired target to warp the pointer to that location and enter normal mode.
4. Use the normal mode movement keys to select the final desination (see Normal Mode).

## Grid Mode
2. Press `M-x` (meta is the command key) to activate the warping process.
2. Press `M-z` (meta is the command key) to activate the warping process.
3. Use `u`,`i`,`j`,`k` to repeatedly navigate to different quadrants.
4. Press `m` to left click, `,` to middle click or `.` to right click.
5. See Normal Mode

## Hint Mode
2. Press `M-z` to generate a list of hints
3. Enter the key sequence associated with the desired target to warp the pointer to that location and enter discrete mode.
4. Use the discrete mode movement keys to select the final desination (see below).

## Discrete Mode
2. Press `M-c` to activate discrete mode.
3. Use the discrete movement keys (default `hjkl`) to adjust the cursor.
## Normal Mode
2. Press `M-c` to activate normal mode.
3. Use the normal movement keys (default `hjkl`) to adjust the cursor.
4. Press `m` to left click, `,` to middle click or `.` to right click.
5. Press `q` to quit.

A drag movement can be simulated from any of the above modes by focusing on the source and then pressing the `drag_key` (default `v`) which will cause the same mode to be reactived for selection of the drag target.
A drag movement can be simulated from any of the above modes by focusing on the source and then pressing the `drag_key` (default `v`) which will cause normal mode to be activated for selection of the drag target.

A more comprehensive description can be found in the man page (along with a list of options).

Expand Down
1 change: 1 addition & 0 deletions TODO
@@ -0,0 +1 @@
- Update docs/demos
74 changes: 38 additions & 36 deletions cfg.opts
@@ -1,9 +1,9 @@
hint_activation_key string "M-z" "Activates hint mode."
grid_activation_key string "M-x" "Activates grid mode and allows for further manipulation of the pointer using the mapped keys."
discrete_activation_key string "M-c" "Activate discrete movement mode (manual cursor movement)."
hint_activation_key string "M-x" "Activates hint mode."
grid_activation_key string "M-z" "Activates grid mode and allows for further manipulation of the pointer using the mapped keys."
normal_activation_key string "M-c" "Activate normal movement mode (manual cursor movement)."

movement_increment int 20 "The movement increment used for grid and discrete mode."
buttons string "m,comma,period,x,c" "Keys corresponding to mouse buttons (4/5 == scroll down/scroll up)."
movement_increment int 20 "The movement increment used for grid and normal mode."
buttons string "m,comma,period,u,i,y,o" "Keys corresponding to mouse buttons (4/5 == scroll down/scroll up while 6/7 correpond to scroll left/right)."
exit string "Escape" "The key used to prematurely terminate the current movement session."
double_click_timeout int 300 "The length of time (in ms) before warp automatically deactivates after the last click. 0 disables automatic deactivation entirely. This option only applies to button 1 (left click)."
drag_key string "v" "Drag mode activation key."
Expand All @@ -24,40 +24,42 @@ grid_line_width int 5 "The size of grid line

hint_width int 40 "The height (in pixels) of a hint."
hint_height int 30 "The width (in pixels) of a hint."
hint_up string "k" "Moves the cursor up by movement_increment once a label has been selected in hint mode."
hint_left string "h" "Moves the cursor left by movement_increment once a label has been selected in hint mode."
hint_down string "j" "Moves the cursor down by movement_increment once a label has been selected in hint mode."
hint_right string "l" "Moves the cursor right by movement_increment once a label has been selected in hint mode."

hint_bgcolor string "#00ff00" "The background hint color."
hint_fgcolor string "#000000" "The foreground hint color."
hint_characters string "asdfghjkl;'zxcvbm,./" "The set of hint characters used by hint mode."
hint_opacity int 100 "Hint transparency (requires a compositor)."

discrete_left_word string "b" "Move the cursor left by word size in discrete mode."
discrete_right_word string "w" "Move the cursor right by word size in discrete mode."
discrete_down_word string "S-j" "Move the cursor down by word size in discrete mode."
discrete_up_word string "S-k" "Move the cursor up by word size in discrete mode."

discrete_left string "h" "Move the cursor left in discrete mode."
discrete_down string "j" "Move the cursor down in discrete mode."
discrete_up string "k" "Move the cursor up in discrete mode."
discrete_right string "l" "Move the cursor right in discrete mode."
discrete_color string "#00ff00" "The color of the pointer in discrete mode."
discrete_size int 20 "The height (in pixels) of the pointer n discrete mode."

discrete_home string "S-h" "Moves the cursor to the top of the screen in discrete mode."
discrete_middle string "S-m" "Moves the cursor to the middle of the screen in discrete mode."
discrete_last string "S-l" "Moves the cursor to the bottom of the screen in discrete mode."
discrete_beginning string "S-6" "Moves the cursor to the leftmost corner of the screen in discrete mode."
discrete_end string "S-4" "Moves the cursor to the rightmost corner of the screen in discrete mode."
discrete_word_size int 80 "Size of the increment used by discrete_*_word."

scroll_fling_timeout int 150 "Double tap timeout used to determine fling intention."
scroll_fling_velocity int 40 "Initial fling velocity."
scroll_fling_acceleration int 10 "Fling acceleration."
scroll_fling_deceleration int 30 "Fling deceleration."
scroll_velocity int 10 "Scroll velocity."
scroll_acceleration int 30 "Scroll acceleration."
scroll_down_key string "A-e" "Scroll down key."
scroll_up_key string "A-y" "Scroll up key."
normal_left_word string "b" "Move the cursor left by word size in normal mode."
normal_right_word string "w" "Move the cursor right by word size in normal mode."
normal_down_word string "S-j" "Move the cursor down by word size in normal mode."
normal_up_word string "S-k" "Move the cursor up by word size in normal mode."

normal_left string "h" "Move the cursor left in normal mode."
normal_down string "j" "Move the cursor down in normal mode."
normal_up string "k" "Move the cursor up in normal mode."
normal_right string "l" "Move the cursor right in normal mode."
normal_color string "#00ff00" "The color of the pointer in normal mode."
normal_size int 20 "The height (in pixels) of the pointer n normal mode."

normal_home string "S-h" "Moves the cursor to the top of the screen in normal mode."
normal_middle string "S-m" "Moves the cursor to the middle of the screen in normal mode."
normal_last string "S-l" "Moves the cursor to the bottom of the screen in normal mode."
normal_beginning string "S-6" "Moves the cursor to the leftmost corner of the screen in normal mode."
normal_end string "S-4" "Moves the cursor to the rightmost corner of the screen in normal mode."
normal_word_size int 80 "Size of the increment used by normal*_word."
normal_hint_key string "x" "Activate hint mode while in normal mode."
normal_grid_key string "g" "Activate grid mode while in normal mode."

scroll_fling_timeout int 150 "Double tap timeout used to determine fling intention."
scroll_fling_velocity int 40 "Initial fling velocity."
scroll_fling_acceleration int 10 "Fling acceleration."
scroll_fling_deceleration int 30 "Fling deceleration."
scroll_velocity int 10 "Scroll velocity."
scroll_acceleration int 30 "Scroll acceleration."
scroll_down_key string "A-j" "Scroll down key."
scroll_up_key string "A-k" "Scroll up key."
scroll_right_key string "A-l" "Scroll right key."
scroll_left_key string "A-h" "Scroll left key."

oneshot_mode string "false" "If set to true immediately close warp after a button has been pressed."
3 changes: 3 additions & 0 deletions gen_assets.py
Expand Up @@ -87,6 +87,9 @@
while(getline(&line, &n, fp) != -1) {
ln++;
char *key, *val;
if(line[0] == '\n' || line[0] == '\0') continue;
if(kvp(line, &key, &val)) {
fprintf(stderr, "Invalid entry in %s at line %lu.\n", fname, ln);
exit(1);
Expand Down

0 comments on commit 65e8cd6

Please sign in to comment.