Skip to content

Commit

Permalink
Add toggle-start, to allow a key to be both start and end
Browse files Browse the repository at this point in the history
  • Loading branch information
mgsloan committed Aug 26, 2017
1 parent 61d7051 commit 29b5ff7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion keynav.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ void cmd_daemonize(char *args);
void cmd_doubleclick(char *args);
void cmd_drag(char *args);
void cmd_end(char *args);
void cmd_toggle_start(char *args);
void cmd_grid(char *args);
void cmd_grid_nav(char *args);
void cmd_history_back(char *args);
Expand Down Expand Up @@ -228,6 +229,7 @@ dispatch_t dispatch[] = {
"sh", cmd_shell,
"start", cmd_start,
"end", cmd_end,
"toggle-start", cmd_toggle_start,
"history-back", cmd_history_back,
"quit", cmd_quit,
"restart", cmd_restart,
Expand Down Expand Up @@ -365,7 +367,7 @@ void addbinding(int keycode, int mods, char *commands) {
keybinding->mods = mods;
g_ptr_array_add(keybindings, keybinding);

if (!strncmp(commands, "start", 5)) {
if (!strncmp(commands, "start", 5) || !strncmp(commands, "toggle-start", 12)) {
int i = 0;
startkey_t *startkey = calloc(sizeof(startkey_t), 1);
startkey->keycode = keycode;
Expand Down Expand Up @@ -1017,6 +1019,14 @@ void cmd_end(char *args) {
zone = 0;
}

void cmd_toggle_start(char *args) {
if (ISACTIVE) {
cmd_end(args);
} else {
cmd_start(args);
}
}

void cmd_history_back(char *args) {
if (!ISACTIVE)
return;
Expand Down

0 comments on commit 29b5ff7

Please sign in to comment.