action: refactor action()

This commit is contained in:
Johan Malm 2020-09-25 19:37:51 +01:00
parent d15e48269d
commit 745915c0ba
3 changed files with 10 additions and 10 deletions

View file

@ -4,20 +4,20 @@
#include <strings.h>
void action(struct server *server, struct keybind *keybind)
void action(struct server *server, const char *action, const char *command)
{
if (!keybind || !keybind->action)
if (!action)
return;
if (!strcasecmp(keybind->action, "Exit")) {
if (!strcasecmp(action, "Exit")) {
wl_display_terminate(server->wl_display);
} else if (!strcasecmp(keybind->action, "NextWindow")) {
} else if (!strcasecmp(action, "NextWindow")) {
server->cycle_view =
desktop_next_view(server, server->cycle_view);
} else if (!strcasecmp(keybind->action, "Execute")) {
spawn_async_no_shell(keybind->command);
} else if (!strcasecmp(keybind->action, "debug-views")) {
} else if (!strcasecmp(action, "Execute")) {
spawn_async_no_shell(command);
} else if (!strcasecmp(action, "debug-views")) {
dbg_show_views(server);
} else {
warn("action (%s) not supported", keybind->action);
warn("action (%s) not supported", action);
}
}