use the new parser for handling keybindings
This commit is contained in:
parent
5eae706427
commit
7adf921bc3
|
@ -97,7 +97,7 @@ int handle_key_press(void *ignored, xcb_connection_t *conn, xcb_key_press_event_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_command(bind->command);
|
parse_cmd(bind->command);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
66
src/nc.c
66
src/nc.c
|
@ -62,72 +62,6 @@ static void xcb_check_cb(EV_P_ ev_check *w, int revents) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_command(const char *command) {
|
|
||||||
printf("received command: %s\n", command);
|
|
||||||
|
|
||||||
if (strcasecmp(command, "open") == 0)
|
|
||||||
tree_open_con(NULL);
|
|
||||||
else if (strcasecmp(command, "close") == 0)
|
|
||||||
tree_close_con();
|
|
||||||
else if (strcasecmp(command, "split h") == 0)
|
|
||||||
tree_split(focused, HORIZ);
|
|
||||||
else if (strcasecmp(command, "split v") == 0)
|
|
||||||
tree_split(focused, VERT);
|
|
||||||
else if (strcasecmp(command, "level up") == 0)
|
|
||||||
level_up();
|
|
||||||
else if (strcasecmp(command, "level down") == 0)
|
|
||||||
level_down();
|
|
||||||
else if (strcasecmp(command, "prev h") == 0)
|
|
||||||
tree_next('p', HORIZ);
|
|
||||||
else if (strcasecmp(command, "prev v") == 0)
|
|
||||||
tree_next('p', VERT);
|
|
||||||
else if (strcasecmp(command, "next h") == 0)
|
|
||||||
tree_next('n', HORIZ);
|
|
||||||
else if (strcasecmp(command, "next v") == 0)
|
|
||||||
tree_next('n', VERT);
|
|
||||||
else if (strncasecmp(command, "workspace ", strlen("workspace ")) == 0)
|
|
||||||
workspace_show(command + strlen("workspace "));
|
|
||||||
else if (strcasecmp(command, "stack") == 0) {
|
|
||||||
focused->layout = L_STACKED;
|
|
||||||
}
|
|
||||||
else if (strcasecmp(command, "fullscreen") == 0) {
|
|
||||||
if (focused->fullscreen_mode == CF_NONE)
|
|
||||||
focused->fullscreen_mode = CF_OUTPUT;
|
|
||||||
else focused->fullscreen_mode = CF_NONE;
|
|
||||||
}
|
|
||||||
else if (strcasecmp(command, "move before h") == 0)
|
|
||||||
tree_move('p', HORIZ);
|
|
||||||
else if (strcasecmp(command, "move before v") == 0)
|
|
||||||
tree_move('p', VERT);
|
|
||||||
else if (strcasecmp(command, "move after h") == 0)
|
|
||||||
tree_move('n', HORIZ);
|
|
||||||
else if (strcasecmp(command, "move after v") == 0)
|
|
||||||
tree_move('n', VERT);
|
|
||||||
else if (strncasecmp(command, "restore", strlen("restore")) == 0)
|
|
||||||
tree_append_json(command + strlen("restore "));
|
|
||||||
else if (strncasecmp(command, "exec", strlen("exec")) == 0)
|
|
||||||
start_application(command + strlen("exec "));
|
|
||||||
else if (strcasecmp(command, "restart") == 0)
|
|
||||||
i3_restart();
|
|
||||||
else if (strcasecmp(command, "floating") == 0) {
|
|
||||||
//toggle_floating_mode(focused, false);
|
|
||||||
parse_cmd("exit");
|
|
||||||
parse_cmd("exec /usr/bin/bleh");
|
|
||||||
parse_cmd("exec kill -9 33");
|
|
||||||
parse_cmd("kill");
|
|
||||||
parse_cmd("[ class=\"Xpdf\" ] kill");
|
|
||||||
parse_cmd("[ class=\"firefox\" ] kill");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
tree_render();
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (strcasecmp(command, "prev") == 0)
|
|
||||||
tree_prev(O_CURRENT);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
//parse_cmd("[ foo ] attach, attach ; focus");
|
//parse_cmd("[ foo ] attach, attach ; focus");
|
||||||
int screens;
|
int screens;
|
||||||
|
|
Loading…
Reference in New Issue