Skip to content

Commit

Permalink
Initial oversimplified POC implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuchteq committed Dec 31, 2023
1 parent b32c995 commit 1ec6dd0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions doc/tofi.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ the form **--key=value**.

> An error occurred, or the user exited without making a selection.
2

> Alternative Success; a selection was made, but the user held down control when confirming it. Useful for building "multi-level" select prompts.
## AUTHORS

Philip Jones \<<[email protected]>\>
Expand Down
7 changes: 5 additions & 2 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ void input_handle_keypress(struct tofi *tofi, xkb_keycode_t keycode)
|| ((key == KEY_C || key == KEY_LEFTBRACE) && ctrl)) {
tofi->closed = true;
return;
} else if (ctrl && (key == KEY_ENTER || key == KEY_KPENTER)) {
tofi->submit = true;
tofi->submit_extra = true;
return;
} else if (key == KEY_ENTER || key == KEY_KPENTER) {
tofi->submit = true;
return;
}

}
if (tofi->auto_accept_single && tofi->window.entry.results.count == 1) {
tofi->submit = true;
}
Expand Down
6 changes: 5 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1924,5 +1924,9 @@ int main(int argc, char *argv[])
if (tofi.closed) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
if(tofi.submit_extra) {
return 2;
} else {
return EXIT_SUCCESS;
}
}
1 change: 1 addition & 0 deletions src/tofi.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct tofi {

/* State */
bool submit;
bool submit_extra;
bool closed;
int32_t output_width;
int32_t output_height;
Expand Down

0 comments on commit 1ec6dd0

Please sign in to comment.