labwc/src/action.c

34 lines
794 B
C
Raw Normal View History

2020-09-25 19:42:40 +01:00
#include <strings.h>
2020-08-12 19:37:44 +01:00
#include "common/log.h"
#include "common/spawn.h"
2020-09-25 20:05:20 +01:00
#include "labwc.h"
2020-06-18 20:18:01 +01:00
static void
reconfigure(void)
2020-09-25 19:42:40 +01:00
{
char *const args[] = { "killall", "-SIGHUP", "labwc", NULL };
execvp(args[0], args);
}
2020-06-18 20:18:01 +01:00
void
action(struct server *server, const char *action, const char *command)
2020-06-18 20:18:01 +01:00
{
2020-09-25 19:37:51 +01:00
if (!action)
2020-06-18 20:18:01 +01:00
return;
2020-09-25 19:37:51 +01:00
if (!strcasecmp(action, "Exit")) {
2020-06-18 20:18:01 +01:00
wl_display_terminate(server->wl_display);
2020-09-25 19:42:40 +01:00
} else if (!strcasecmp(action, "Execute")) {
spawn_async_no_shell(command);
2020-09-25 19:37:51 +01:00
} else if (!strcasecmp(action, "NextWindow")) {
server->cycle_view =
desktop_next_view(server, server->cycle_view);
2020-09-25 19:42:40 +01:00
} else if (!strcasecmp(action, "Reconfigure")) {
reconfigure();
2020-10-19 22:14:17 +01:00
} else if (!strcasecmp(action, "Debug")) {
2020-06-18 20:18:01 +01:00
dbg_show_views(server);
} else {
2020-09-25 19:37:51 +01:00
warn("action (%s) not supported", action);
2020-06-18 20:18:01 +01:00
}
}