From 7adf921bc32cf5f167fd36d5bf4cfe0b3587fa7a Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 11 May 2010 23:04:47 +0200 Subject: [PATCH] use the new parser for handling keybindings --- src/handlers.c | 2 +- src/nc.c | 66 -------------------------------------------------- 2 files changed, 1 insertion(+), 67 deletions(-) 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;