From: Michael Stapelberg Date: Tue, 11 May 2010 21:04:47 +0000 (+0200) Subject: use the new parser for handling keybindings X-Git-Tag: tree-pr1~217 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7adf921bc32cf5f167fd36d5bf4cfe0b3587fa7a;p=i3%2Fi3 use the new parser for handling keybindings --- diff --git a/src/handlers.c b/src/handlers.c index 535d963e..4921fdea 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -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; } diff --git a/src/nc.c b/src/nc.c index 8cd325a8..cb3569a0 100644 --- a/src/nc.c +++ b/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[]) { //parse_cmd("[ foo ] attach, attach ; focus"); int screens;